Skip to content

Inserter: Media tab doesn't stay up to date with media inserted in the editor when kept open #70397

@talldan

Description

@talldan

Description

The inserter media tab can end up with outdated state now that the inserter stays open. It relies on the page being reloaded to refresh the set of images shown.

I think this is because the uploadMedia util relies on apiFetch and isn't concerned about invalidating the state of the entities in the core-data store.

Step-by-step reproduction instructions

  1. Open the Inserter sidebar
  2. Go to Media > Images and keep this open
  3. In the editor add an image block and upload an image
  4. Observe that the inpsector sidebar doesn't show the uploaded image
  5. Switch to the Openverse category and back to the Images category in the sidebar

Expected: The new image should be shown in the Inserter without having to close/reopen it
Actual: The inserter is outdated.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Feature] MediaAnything that impacts the experience of managing media[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions