-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Editor: Additional error messages for media upload failures #17971
Conversation
When an upload's thumbnail is ready, we don't currently check whether the upload actually failed. That leads to a situation where failed uploads are assigned an "uploading" state, which prevents Gutenberg from getting the necessary signals to display an error message for the failure. With this commit, a check for whether an upload failed is added to prevent this issue.
6af98a4
to
6f60580
Compare
This code is redundant as it is duplicative of code surrounding it, it was mistakenly kept in the first commit.
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.
Code looks good and this works well. Such a huge improvement to the UX! 🙌 🥇
RELEASE-NOTES.txt
Outdated
@@ -5,6 +5,7 @@ | |||
* [*] Add "Copy Link" functionality to Posts List and Pages List [#17911] | |||
* [*] [Jetpack-only] Enables the ability to use and create WordPress.com sites, and enables the Reader tab. [#17914, #17948] | |||
* [*] Block editor: Autocorrected Headings no longer apply bold formatting if they weren't already bold. [#17844] | |||
* [*] Block editor: Prevent "missing" error messages with media upload failures. [#17971] |
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.
Not a big deal, but the quoted "missing" reads a bit oddly to me (why is missing in quotes? are they not really missing?). I might try phrasing this positively with something like "Additional error messages for media upload failures".
What you have now is fine, so this is definitely not a blocker. Feel free to leave as-is if you prefer.
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.
I appreciate that feedback, thank you! Updated the note in 3ebc362.
Generated by 🚫 dangerJS |
Fixes #14400
Description
When an image fails to load via the image block in the editor (for any reason other than there being no Internet connection) a progress indicator currently remains indefinitely on screen. The user will only see an error if they tap on the image (in which case an error appears in the Retry action sheet) or if they save the post as a draft.
Proposed changes
When an upload's thumbnail is ready, we don't currently check whether the upload failed, we only check whether the app is connected to the Internet (as per #14140). That leads to a situation where uploads that fail (for reasons other than no Internet connection) are assigned an "uploading" state via this line of code. This sends a signal back to Gutenberg and prevents an error message for the failure from being displayed correctly.
With this PR, a check for whether an upload failed has been added to guard against that in the
thumbnailReady
state here. I chose to usemedia.remoteStatus == .failed
for the check as it matches the pattern used in the switch statement here for uploads to the Media Library.Screenshots
You'll see that, prior to this change, an upload failed "silently", with no error message to indicate that it was not successful. The changes in this PR address that issue so that the error message now displays as expected following the failure:
Testing
Prerequisite: A WordPress.com Simple site with a media library that's been filled up to the site's storage limit. The credentials for an existing test site that matches that criteria be found here: paaHJt-17e-p2#comment-2395
Steps to test:
Regression Notes
The code area that's been tweaked with this change relates to the way an image's thumbnail appears when it's uploaded in the editor. It may therefore unintentionally impact the way the thumbnail appears.
Manually tested uploading an image to ensure the thumbnail displays as expected, both when the upload fails and when it's successful.
No automated tests have been added as this is a relatively small fix for the UI, I didn't feel an automated test was necessary.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.