Invalid UI state when pressing undo after uploading an image #8045
Labels
[Feature] Blocks
Overall functionality of blocks
[Feature] Media
Anything that impacts the experience of managing media
[Status] Duplicate
Used to indicate that a current issue matches an existing one and can be closed
[Type] Bug
An existing feature does not function as intended
Milestone
Describe the bug
It's possible to put the image block into a weird UI state by pressing undo after you upload an image using drag-and-drop.
To Reproduce
Expected behavior
The placeholder should be shown again. Instead, the image block pulsates as if it were still uploading.
Screenshots
Desktop (please complete the following information):
Additional context
This also happens when the block is created by drag-and-dropping media directly into the editor. The Gallery and File blocks have similar bugs as well.
The problem is that we use the
href
attribute to store theblob:
URL of the media that is being uploaded. This causes other related bugs, too. For example, if you refresh the page while media is uploading, the block doesn't display correctly.We probably should be using
this.setState()
instead ofthis.props.setAttributes()
to store intermittent data such as the file that is currently being uploaded. It's not clear how we would supportfile
transforms if we do this, though.The text was updated successfully, but these errors were encountered: