Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

madsrasmussen
Copy link
Contributor

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.

@Copilot Copilot AI review requested due to automatic review settings July 1, 2025 08:09
Copy link
Contributor

@Copilot 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

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 with match: 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 if createScaffold or downstream components expect mediaType.collection. Consider updating createScaffold 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';
Copy link
Preview

Copilot AI Jul 1, 2025

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.

kows added a commit to kows/Umbraco-CMS that referenced this pull request Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant