Skip to content

Recycle Bin: Trigger cache invalidation for trashed document/media items#20483

Merged
leekelleher merged 3 commits intomainfrom
v16/bugfix/media-item-trashed-cache-invalidation
Oct 13, 2025
Merged

Recycle Bin: Trigger cache invalidation for trashed document/media items#20483
leekelleher merged 3 commits intomainfrom
v16/bugfix/media-item-trashed-cache-invalidation

Conversation

@leekelleher
Copy link
Member

Description

Adds support for Trashed server-events on the client, to trigger cache invalidation for document and media items.

Also, adds the client-side event to trigger the tree/menu reload when an item is being restored from the recycle bin.

How to test?

On a document with a Media Picker, select a media item. Then go to the media item and trash it. Go back to the document with the Media Picker and notice that the picked media item has the "Trashed" tag/label.

Copilot AI review requested due to automatic review settings October 13, 2025 13:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds client-side handling for server “Trashed” events to invalidate caches for media and document items, and dispatches UI reload events when restoring from the recycle bin.

  • Introduces optional eventTypes in cache invalidation managers and uses it to include “Trashed”
  • Triggers both source structure reload and destination-children reload on restore-from-recycle-bin actions
  • Sets modal default destination entityType based on incoming data

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Umbraco.Web.UI.Client/src/packages/management-api/item/cache-invalidation.manager.ts Adds optional eventTypes and uses it when subscribing to server events
src/Umbraco.Web.UI.Client/src/packages/management-api/detail/cache-invalidation.manager.ts Mirrors optional eventTypes support for detail caches
src/Umbraco.Web.UI.Client/src/packages/media/media/repository/item/media-item.server.cache-invalidation.manager.ts Includes Trashed in media cache invalidation eventTypes
src/Umbraco.Web.UI.Client/src/packages/documents/documents/item/repository/document-item.server.cache-invalidation.manager.ts Includes Trashed in document cache invalidation eventTypes
src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/entity-action/restore-from-recycle-bin/restore-from-recycle-bin.action.ts Dispatches reload events for source structure and destination children after restore
src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/entity-action/restore-from-recycle-bin/modal/restore-from-recycle-bin-modal.element.ts Defaults destination entityType from incoming modal data

Copy link
Contributor

@iOvergaard iOvergaard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, but there is a failing e2e test. Does not seem to be related at all, but I wonder what it is. I'll try to restart the tests.

@leekelleher leekelleher merged commit 3ac37f3 into main Oct 13, 2025
27 checks passed
@leekelleher leekelleher deleted the v16/bugfix/media-item-trashed-cache-invalidation branch October 13, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants