-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Lock post saving during image uploads #41120
Lock post saving during image uploads #41120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added a couple of comments.
…com:adamsilverstein/gutenberg into issue/39223-save-while-uploading-incomplete
… during media uploads
@ryanwelcher / @Mamaduka - I cleaned this up a bit and this code now does lock the publish/update buttons while image uploads are processing, however I noticed some issues remain I'm not sure how to address...
I feel like we may need an additional editor store attribute for "imagesUploading" added to the conditionals, or maybe we can tap into experimental "entity saving" logic instead? or maybe we can somehow change isSaving or forceIsSaving - basically the editor shows the correct state during saves, and in a sense the image are being saved so it feels like the right fit, but i'm not sure how to control it or if we need another attribute. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Just tested this and can confirm the option to save remains greyed out while you have a photo uploading, making for a clearer experience: no.option.to.update.movThis is compared to the current experience: current.experience.for.media.upload.mov |
@ellatrix - actually, I wasn't testing correctly, this works as expected. the inner "publish confirmation" button is what gets disabled for an unpublished post. To test, first open the publish confirmation panel by clicking the initial publish button. then try uploading one or more very large image(s) (or throttle your network connection). note the inner publish button is disabled for the duration of the upload(s). after clicking this button you see another publish button that I am calling the publish confirmation button: Here is a quick screencast, in it you can see I added some console logging as each image upload locks saving and then unlocks it when uploading completes. Monosnap.screencast.2024-07-08.14-53-35.mp4 |
any additional feedback @ellatrix @Mamaduka or @youknowriad? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me 👍
It feels perfect for an e2e test but can also be done separately.
I think the PR description deserves to be expanded a bit. We should not expect reviewers to click all the links to be able to understand what's happening here. |
I think you need to run |
done |
Expanded with details from the Issue. |
What?
Fixes #39223
Improves the media upload experience and prevents saving/publishing while images are still uploading.
Why?
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.
How?
Locks the save/publish mechanism until all image uploads have completed.
Testing Instructions
Screenshots or screencast
share.getcloudapp.com/8LuDGjnD