Media Workspace: Fix collection view showing root items after creating new folder (closes #21700)#21753
Media Workspace: Fix collection view showing root items after creating new folder (closes #21700)#21753AndyButland wants to merge 1 commit intomainfrom
Conversation
…or new media folders.
There was a problem hiding this comment.
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 duringcreateScaffold(). - Remove the previous “set unique after processing” placement to align with the
load()flow.
| @@ -327,7 +331,6 @@ export abstract class UmbEntityDetailWorkspaceContextBase< | |||
| } | |||
|
|
|||
| this.setIsNew(true); | |||
| this.#entityContext.setUnique(data.unique); | |||
| this._data.setPersisted(data); | |||
| this._data.setCurrent(data); | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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 increateScaffold()to before_scaffoldProcessData(), matching the pattern already used inload(). After this I no longer see the problem.Testing