-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Hide Document/Media Collection Workspace View until the item is created #19644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Hide Document/Media Collection Workspace View until the item is created #19644
Conversation
…rkspace-view-condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Ensures that the collection workspace view for media and document items is only shown after the item has been created.
- Removes the default
collection: null
from the media scaffold preset to prevent rendering before creation. - Imports and applies
UMB_WORKSPACE_ENTITY_IS_NEW_CONDITION_ALIAS
withmatch: false
in both media and document manifests to hide the workspace when the entity is new. - Updates workspace manifest imports to include the new condition alias.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/Umbraco.Web.UI.Client/src/packages/media/media/workspace/media-workspace.context.ts | Dropped the collection field in the scaffold preset for media. |
src/Umbraco.Web.UI.Client/src/packages/media/media/workspace/manifests.ts | Added import and condition to hide the media workspace until item exists. |
src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/manifests.ts | Added import and condition to hide the document workspace until item exists. |
Comments suppressed due to low confidence (3)
src/Umbraco.Web.UI.Client/src/packages/media/media/workspace/manifests.ts:41
- No tests currently verify that the media workspace is hidden for new entities. Add unit or integration tests to assert that this condition (
match: false
) prevents rendering until the media item is created.
},
src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/manifests.ts:41
- Add tests to confirm that the document workspace does not render when the document is new, matching the newly introduced
UMB_WORKSPACE_ENTITY_IS_NEW_CONDITION_ALIAS
condition.
},
src/Umbraco.Web.UI.Client/src/packages/media/media/workspace/media-workspace.context.ts:79
- Removing the
collection
property from the scaffold preset may lead to undefined behavior ifcreateScaffold
or downstream components expectmediaType.collection
. Consider updatingcreateScaffold
to handle the absence of this field or explicitly marking it optional in its signature.
preset: { mediaType: { unique: mediaTypeUnique } },
UmbSubmitWorkspaceAction, | ||
UMB_WORKSPACE_CONDITION_ALIAS, | ||
UMB_WORKSPACE_ENTITY_IS_NEW_CONDITION_ALIAS, | ||
} from '@umbraco-cms/backoffice/workspace'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The import and condition block for UMB_WORKSPACE_ENTITY_IS_NEW_CONDITION_ALIAS
is duplicated across media and documents manifests. Consider extracting common manifest condition definitions into a shared helper to reduce duplication.
Copilot uses AI. Check for mistakes.
It doesn't make sense to view or create children under an item that doesn't exist yet. This PR makes sure we don't render the collection workspace view until the item is created.