Skip to content
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

File/Image delete causes 409 error response on page update #6129

Closed
29avet1 opened this issue Dec 26, 2023 · 6 comments
Closed

File/Image delete causes 409 error response on page update #6129

29avet1 opened this issue Dec 26, 2023 · 6 comments
Assignees
Labels
needs more info More information is required

Comments

@29avet1
Copy link

29avet1 commented Dec 26, 2023

  • Laravel Version: 10.19.0
  • Nova Version: 4.27.14
  • PHP Version: 8.2

Description:

When we delete a file or image on page edit, then we click the update button, it throws a 409 error "Another user has updated this resource since this page was loaded".
It is caused by the fact that after deleting the image it touches the row in db, sets the image name to null, and also "updated at" is getting refreshed. By this, the "retrieved_at" value is responsible for checking whether another person has edited this resource or not, becomes outdated.
I saw that the nova file input triggers an event "file-deleted", which in "HasOneFiled.vue" is handled and triggers another "update-last-retrieved-at-timestamp" event, which I suppose updates the retrieved_at value to avoid this issue, but in "Update.vue" the "handleFileDeleted" method is empty and not triggering the "update-last-retrieved-at-timestamp" event.

Detailed steps to reproduce the issue on a fresh Nova installation:

  1. open the Edit resource page with an image input. upload an image and save, or open an edit page that already contains an uploaded image
  2. delete the image, then click the "Update" button. it will throw an error.
@crynobone crynobone added the pending Issues that are pending triage label Feb 12, 2024
@Keko-94
Copy link

Keko-94 commented Jul 9, 2024

Same problem with the latest Nova v4.34.3.
Any update of this ?

@jeremynikolic jeremynikolic self-assigned this Aug 23, 2024
@jeremynikolic
Copy link

jeremynikolic commented Aug 23, 2024

Thanks @29avet1 for reporting this, I'll be looking into it 🕵️

@jeremynikolic
Copy link

Seems like I can't reproduce this 🤔
If you still encounter the issue please provider a reproducing repo 🙏

After looking at how components are stacked and the chain of events in the described case, all is good with updating images:

  • FileField -> file-deleted
  • Panel@file-deleted -> update-last-retrieved-at-timestamp
  • Update@update-last-retrieved-at-timestamp -> does update its lastRetrivedAt

@jeremynikolic jeremynikolic added needs more info More information is required pending Issues that are pending triage and removed pending Issues that are pending triage labels Aug 23, 2024
@29avet1
Copy link
Author

29avet1 commented Sep 6, 2024

@jeremynikolic
The problem still exists in v4.35.0
This happens in case you use an s3 storage disk. I checked with AWS s3 and Cloudinary.
For the local disk, it works well.

  Image::make('Top image')
      ->disk('cloudinary_memberstory')
      ->hideFromIndex()
      ->rules('nullable', 'image', 'mimes:jpeg,jpg,png', 'max:10240')
      ->preview(fn() => $this->topImageUrl)
      ->prunable(),

@jeremynikolic jeremynikolic removed the pending Issues that are pending triage label Sep 6, 2024
@jeremynikolic
Copy link

I've rerun my tests on different storages, as well as file and image fields, same as last time.
Still unable to reproduce this issue 🤔

@crynobone
Copy link
Member

Hey there,

We're closing this issue because it's inactive, already solved, old, or not relevant anymore. Feel free to open up a new issue if you're still experiencing this problem.

@crynobone crynobone closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info More information is required
Projects
None yet
Development

No branches or pull requests

4 participants