Skip to content

Conversation

@iOvergaard
Copy link
Contributor

Summary

When calling name() or getName() without a variantId argument, the methods now correctly return the name of the first active variant from the split view instead of always returning the first variant in the data array.

Key changes:

  • name() returns a reactive observable that updates when the active variant changes, using mergeObservables to combine the split view's active variant observable with the variants data
  • getName() uses splitView.getActiveVariants()[0] to get the current active variant synchronously, with a fallback to the first variant if no active variant is set
  • Updated JSDoc comments to clarify the behavior when no variantId is provided

This fixes an issue where block previews could not reactively observe the document name because the callback parameter was always empty when calling context.name().

Related Issues

Test plan

  • Verified with invariant document - name displays correctly
  • Verified with variant document - name updates correctly when switching between language variants
  • Verified no console errors related to the change
  • Build passes without type errors

🤖 Generated with Claude Code

…ntId provided

When calling `name()` or `getName()` without a variantId argument, the methods
now correctly return the name of the first active variant from the split view
instead of always returning the first variant in the data array.

The `name()` method now returns a reactive observable that updates when the
active variant changes, using `mergeObservables` to combine the split view's
active variant observable with the variants data.

The `getName()` method now uses `splitView.getActiveVariants()[0]` to get the
current active variant synchronously, with a fallback to the first variant if
no active variant is set.

This fixes an issue where block previews could not reactively observe the
document name because the callback parameter was always empty.

Closes #20759

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copilot AI review requested due to automatic review settings December 16, 2025 15:37
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

This PR fixes the name() and getName() methods in the content detail workspace to return the name of the currently active variant in the split view instead of always returning the first variant from the data array. This enables block previews to reactively observe document names when switching between language variants.

Key changes:

  • Modified getName() to retrieve the active variant from split view using getActiveVariants()[0] instead of always using variants[0]
  • Enhanced name() to return a reactive observable that merges split view's active variant changes with variants data
  • Updated JSDoc documentation to clarify behavior when no variantId is provided

iOvergaard and others added 3 commits December 16, 2025 16:41
Address PR review feedback by using UmbVariantId.Create() and compare()
instead of direct property comparison. This ensures consistent behavior
with the existing variant comparison pattern used throughout the codebase.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link
Member

@nielslyngsoe nielslyngsoe left a comment

Choose a reason for hiding this comment

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

Well done!

@nielslyngsoe nielslyngsoe merged commit 911d2fe into main Dec 17, 2025
28 checks passed
@nielslyngsoe nielslyngsoe deleted the fix/name-method-active-variant branch December 17, 2025 07:48
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.

Observing node name changes not working in v17 backoffice

3 participants