Backoffice: Pre-expand tree to target entity when opening Duplicate and Move To modals (closes #22015)#23063
Backoffice: Pre-expand tree to target entity when opening Duplicate and Move To modals (closes #22015)#23063madsrasmussen wants to merge 14 commits into
Conversation
|
Claude finished @madsrasmussen's task in 8m 2s —— View job PR ReviewTarget: Adds tree pre-expansion to Duplicate To and Move To modals: ancestors are fetched before the modal opens, passed through the modal data token, and applied to the embedded tree via the existing
Suggestions
Approved with Suggestions for improvementClean, well-structured implementation. Error handling in Labels applied: |
There was a problem hiding this comment.
Pull request overview
This PR improves the backoffice “Duplicate to…” and “Move to…” flows by pre-expanding the destination tree to the current entity’s location (using ancestor lookups), rather than always opening collapsed at the root.
Changes:
- Fetch ancestor chains for the current entity and pass them to modals as an expansion model.
- Add optional
treeExpansion/expansionwiring so tree-based modals can open with a predefined expansion state. - Apply the same pre-expansion behavior to both the generic tree actions (duplicate/move) and the document-specific duplicate modal.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/duplicate/modal/duplicate-document-modal.token.ts | Extends duplicate-document modal data with optional tree expansion state. |
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/duplicate/modal/duplicate-document-modal.element.ts | Passes expansion state into the document duplicate destination tree. |
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/duplicate/duplicate-document.action.ts | Requests ancestors and supplies linked expansion entries to the document duplicate modal. |
| src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-picker-modal/types.ts | Adds treeExpansion to the generic tree picker modal data contract. |
| src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-picker-modal/tree-picker-modal.element.ts | Applies provided treeExpansion into the picker context’s expansion manager. |
| src/Umbraco.Web.UI.Client/src/packages/core/tree/entity-actions/move/move-to.action.ts | Computes and passes treeExpansion to the tree picker modal for Move To actions. |
| src/Umbraco.Web.UI.Client/src/packages/core/tree/entity-actions/duplicate-to/modal/duplicate-to-modal.token.ts | Extends duplicate-to modal data with optional tree expansion state. |
| src/Umbraco.Web.UI.Client/src/packages/core/tree/entity-actions/duplicate-to/modal/duplicate-to-modal.element.ts | Passes expansion state into the duplicate-to destination tree. |
| src/Umbraco.Web.UI.Client/src/packages/core/tree/entity-actions/duplicate-to/duplicate-to.action.ts | Computes and passes treeExpansion when opening the duplicate-to modal. |
AndyButland
left a comment
There was a problem hiding this comment.
Works nicely in testing @madsrasmussen - I can see the expected result for all three entity actions. I just had one comment about whether you could de-duplicate some repeated code.
| this.#reloadMenu(); | ||
| } | ||
|
|
||
| async #requestAncestors() { |
There was a problem hiding this comment.
I see this is repeated in duplicate-to.action.ts and duplicate-document.action.ts. Worth extracting into a common helper? The try/catch, comments and removal of self all might be worth having in one place.
Description
Fixes #22015
When opening the Duplicate To or Move To modal from a document or other tree entity, the tree is now pre-expanded to reveal the item's current location in the hierarchy. Previously, the tree always opened collapsed at the root.