Repository navigation
Set error state when there is an upload error in during file upload - #24017
Merged
Merged
Conversation
ItsJonQ
self-requested a review
August 5, 2020 14:39
|
This looks great! I'll test it out on my machine in about 30-60 mins. Will provide an update + review when I can! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #23579
The app was hanging in an infinite loading state when file upload resulted in an error because of an unsupported file type. The problem was that in here
gutenberg/packages/media-utils/src/utils/upload-media.js
Lines 171 to 176 in 0a22d69
the uploaded file is not recognized but is considered to be a valid one. Next when
onFileChangeis called it runsgutenberg/packages/block-library/src/file/edit.js
Lines 90 to 100 in 0a22d69
which sets hasError state to false. At this point the server has not yet responded with an error, so the front-end shows a loader screen. Next the API call is made and
createMediaFromFilethrows.gutenberg/packages/media-utils/src/utils/upload-media.js
Lines 181 to 212 in 0a22d69
onErrorruns but the state is never updated ingutenberg/packages/block-library/src/file/edit.js
Lines 102 to 106 in 0a22d69
How has this been tested?
Manually tested with a file with
.unsupportedextension.Screenshots
Types of changes
Bug fix (non-breaking change)
Checklist: