Recycle Bin: Trigger cache invalidation for trashed document/media items#20483
Merged
leekelleher merged 3 commits intomainfrom Oct 13, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 |
src/Umbraco.Web.UI.Client/src/packages/management-api/item/cache-invalidation.manager.ts
Outdated
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/packages/management-api/item/cache-invalidation.manager.ts
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/packages/management-api/detail/cache-invalidation.manager.ts
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/packages/management-api/item/cache-invalidation.manager.ts
Show resolved
Hide resolved
...s/core/recycle-bin/entity-action/restore-from-recycle-bin/restore-from-recycle-bin.action.ts
Show resolved
Hide resolved
iOvergaard
approved these changes
Oct 13, 2025
Contributor
iOvergaard
left a comment
There was a problem hiding this comment.
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.
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
Adds support for
Trashedserver-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.