Skip to content

Media Workspace: Fix collection view showing root items after creating new folder (closes #21700)#21753

Open
AndyButland wants to merge 1 commit intomainfrom
v17/bugfix/fix-display-after-create-new-folder
Open

Media Workspace: Fix collection view showing root items after creating new folder (closes #21700)#21753
AndyButland wants to merge 1 commit intomainfrom
v17/bugfix/fix-display-after-create-new-folder

Conversation

@AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Feb 13, 2026

Description

This PR addresses #21700, which shows that when creating folders in the media section, the created media's workspace is not properly initialised and still shows the root collection view.

Fix looks to me to move setUnique() call in createScaffold() to before _scaffoldProcessData(), matching the pattern already used in load(). After this I no longer see the problem.

Testing

  • Navigate to Media section root (with existing media items)
  • Click "Create" and select "Folder"
  • Enter a folder name and press Save
  • Verify the "Child Items" tab shows an empty collection (not root-level items)

Copilot AI review requested due to automatic review settings February 13, 2026 17:17
@AndyButland AndyButland changed the title Workspace: Fix collection view showing root items after creating new folder (closes #21700) Media Workspace: Fix collection view showing root items after creating new folder (closes #21700) Feb 13, 2026
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

Fixes a workspace “Child Items” collection view issue where, after creating a new folder from the root, the collection view incorrectly shows root-level items instead of the new folder’s (empty) children. This is addressed by ensuring the workspace entity unique is set early enough for observers triggered during scaffold processing to read the correct parent unique.

Changes:

  • Set the workspace entity unique before _scaffoldProcessData() runs during createScaffold().
  • Remove the previous “set unique after processing” placement to align with the load() flow.

Comment on lines 322 to 335
@@ -327,7 +331,6 @@ export abstract class UmbEntityDetailWorkspaceContextBase<
}

this.setIsNew(true);
this.#entityContext.setUnique(data.unique);
this._data.setPersisted(data);
this._data.setCurrent(data);
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

createScaffold() now sets the entity context unique before _scaffoldProcessData() (good for observers), but it no longer re-syncs the unique after _scaffoldProcessData() and the optional modal preset merge. Since data = { ...data, ...this.modalContext.data.preset } can overwrite unique (it’s a Partial<DetailModelType>), the workspace context unique can end up out of sync with data.unique. Consider either (a) setting the unique again after all processing/merging, or (b) preventing unique from being overridden by the preset merge.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't seem that a preset would provide a unique, the so I think this is OK, but I'll leave this unresolved for more expert review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant