-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Unsaved changes should consider image uploads in progress #39223
Comments
👋🏼 @ellatrix - I got something working in #41120 but it is a bit hacky because I ran into a couple of problems. If you can take a look, I would appreciate any tips!
|
Hi, @adamsilverstein 👋
|
Hey @Mamaduka - thanks for the tips!
Right, hence the errors. Good to know I can can use the "string" method, also sounds like i shouldn't do that!
Good suggestion, I saw this being used but didn't dig into internals. I'll give it a try.
Excellent, I'll need that to track multiple uploads. |
@adamsilverstein this seems to be a duplicate of #5936. Just mentioning so both can be closed when settled. |
There's also #16030 |
Thanks for pointing that out @mtias - that one is about autosave during image uploading so slightly different. I'll double check that locking post saving also locks autosaving, if not I'll update to lock both. |
Despite the title I can't tell if this ticket will be resolved with my PR, it looks like the author wants some event trigger on upload completion which makes me consider another approach. Currently, I'm working to detect when an image upload starts and finishes and locking and locking post saving accordingly. One possible variation would be to track "isImageUploading" in state, then use that bit of state for the conditional to saves. Not sure which makes more sense structurally, just something to consider. |
Description
When users are uploading media and navigate away, uploads and image display break.
Gutenberg displays an "Unsaved Changes" warning if users try to navigate away from the editor with unsaved changes (triggered by
window.beforeunload
). The check for unsaved changes misses images that are still being uploaded allowing users to navigate away while WordPress is still uploading or processing an image.In progress uploads may never complete regeneration if PHP is able to generate all sub sizes in one go, because our retry mechanism will not fire. Regardless, Gutenberg will continue marking the image as "in progress" with a spinner when the upload doesn't complete.
Step-by-step reproduction instructions
Screen recording
https://share.getcloudapp.com/8LuDGjnD
Screenshots
Environment info
Please confirm that you have searched existing issues in the repo.
I did, but I missed this issue which is a duplicate and is now closed - #16030
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: