Skip to content

Introduce Variant Context#19334

Merged
nielslyngsoe merged 13 commits intorelease/16.0from
v16/hotfix/variant-context
May 16, 2025
Merged

Introduce Variant Context#19334
nielslyngsoe merged 13 commits intorelease/16.0from
v16/hotfix/variant-context

Conversation

@madsrasmussen
Copy link
Copy Markdown
Member

The PR introduces a UMB_VARIANT_CONTEXT, laying the groundwork for another PR to add culture-aware search to document/media pickers.

I have chosen a solution for the context that is as standalone as possible. I wanted to avoid having any dependencies from the variant module to the language module, as that would introduce an illegal import. I believe this is the most flexible solution.

This PR currently utilizes the new context within the UmbDocumentItemDataResolver class, which is responsible for displaying the correct document name/state, etc., in the tree, pickers, and other places that reference a document.

How to test:

  • Please ensure that the document name is correct when changing variant in a variant document.

@madsrasmussen madsrasmussen changed the title Variant Context Introduce Variant Context May 15, 2025
@madsrasmussen madsrasmussen marked this pull request as ready for review May 15, 2025 18:50
Copilot AI review requested due to automatic review settings May 15, 2025 18:50
Copy link
Copy Markdown
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

This PR introduces a standalone variant context to support upcoming culture‐aware search features in document and media pickers by decoupling variant logic from the language module.

  • Integrates variant context updates in the app language context.
  • Refactors the document item data resolver to consume variant context and perform async updates for variant aware values.
  • Introduces new variant context files and updates existing property dataset contexts to utilize variant context.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/packages/language/global-contexts/app-language.context.ts Updates to incorporate variant context updates when language changes.
src/packages/documents/documents/item/document-item-data-resolver.ts Refactors resolver to use an async pattern for updating variant aware values via the new variant context.
src/packages/core/workspace/workspace-property-dataset/invariant-workspace-property-dataset-context.ts Updates to initialize the variant context and set the variant id.
src/packages/core/variant/* New context, token, and constant files to support variant functionality.
src/packages/core/property/property-dataset/property-dataset-base-context.ts Integrates variant context usage during variant id initialization.
src/packages/content/content/property-dataset-context/element-property-dataset.context.ts Incorporates variant context when setting the variant id for element property datasets.

@nielslyngsoe nielslyngsoe merged commit e959850 into release/16.0 May 16, 2025
23 checks passed
@nielslyngsoe nielslyngsoe deleted the v16/hotfix/variant-context branch May 16, 2025 10:30
@umbracocommunity
Copy link
Copy Markdown

This pull request has been mentioned on Umbraco community forum. There might be relevant details there:

https://forum.umbraco.com/t/difference-umb-document-workspace-context-and-umb-variant-workspace-context-how-to-determine-variant-language/3813/2

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants