Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traffic Cop improvements #3479

Closed
wimski opened this issue Jul 28, 2021 · 3 comments
Closed

Traffic Cop improvements #3479

wimski opened this issue Jul 28, 2021 · 3 comments

Comments

@wimski
Copy link

wimski commented Jul 28, 2021

  • Laravel Version: 8.52.0
  • Nova Version: 3.27.0
  • PHP Version: 7.4.21

Description:

I'm experiencing a bug with the traffic cop feature that has been reported multiple times. Using Update & Continue Editing on a resource I frequently get the Another user has updated this resource since this page was loaded error message even-though I'm the only user (this is reproducible in my local setup).

This proposed solution seems like a structural fix. Is anything being done with that?

Related issues

@crynobone
Copy link
Member

crynobone commented Jul 28, 2021

updated_at suggestion covers some of the use cases, fields with deletable file/image can trigger model updated_at outside the scope and it doesn't have access to updated_at. Even if it does it is no longer a truth source value (someone may already change other fields on the same model).

hashing suggestion only works with the assumption that each field will correspond with a specific modal attribute and there no mutation happening either via fillUsing(), model observer, or model casting.

@wimski
Copy link
Author

wimski commented Jul 29, 2021

updated_at suggestion covers some of the use cases, fields with deletable file/image can trigger model updated_at outside the scope and this doesn't have access to updated_at. Even if it does it is no longer a truth source value (someone may already change other fields on the same model).

Isn't there another reliable timestamp on the server which can be used? Something from the ActionResource/ActionEvent that keeps track of mutations perhaps?

hashing suggestion only works with the assumption that each field will correspond with a specific modal attribute and there no mutation happening either via fillUsing(), model observer, or model casting.

Agreed, hashing isn't an option.


The whole point is that you can't match a client-side timestamp with a server-side timestamp, because that's comparing apples with oranges. We somehow need an apple from the server-side to do the comparison later on or this feature is fundamentally buggy.

@crynobone
Copy link
Member

Isn't there another reliable timestamp on the server which can be used? Something from the ActionResource/ActionEvent that keeps track of mutations perhaps?

Over-complicated and can potentially cause more unexpected results, and it would be harder to debug.

We somehow need an apple from the server-side to do the comparison later on or this feature is fundamentally buggy.

It is working only in certain criteria, buggy to others.

I wish we can have another way of preventing overriding already replaced value instead of completely abandoning local change if a model has been updated by someone else. But for now, the suggestions only cover some and not all scenarios, and possible to create another fundamentally buggy feature.

@crynobone crynobone changed the title Traffic Cop bug Traffic Cop improvements Aug 11, 2021
@laravel laravel locked and limited conversation to collaborators Aug 11, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants