Content Editing: Fix save composition values on invariant content and save of default segment (closes #22800, #22865)#22846
Conversation
|
Claude finished @AndyButland's task in 3m 24s —— View job PR ReviewTarget: Targeted bugfix that corrects the Suggestions
Approved with Suggestions for improvementThe logic is correct — intersecting the property's variance with the content type's variance is the right model, and the |
There was a problem hiding this comment.
Pull request overview
This PR fixes saving property values for invariant content types that inherit variant properties through compositions, aligning workspace validation with the effective variance of the host content type.
Changes:
- Updates
setPropertyValueto require a variant ID only when both the property and host content type vary by culture or segment. - Documents the effective-variance behavior for variant composition properties on invariant content.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…omposition property. Adds a third mock document/document-type pair representing an invariant content type whose flattened property list contains a culture-variant property (the runtime shape produced when a variant composition is applied to an invariant content type) and a setPropertyValue test asserting the value is stored as a culture/segment-invariant entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…he default segment.
|
Thanks @madsrasmussen (and for the tips on visualising the mocked data). What you've set up looks correct to me, and as you say, work as verification of the fix. |
… save of default segment (closes #22800, #22865) (#22846) * Fix edit of a variant property composed to an invariant document. * Collapse multi-line guard comment to a single line per project policy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Add unit test coverage for invariant content with a culture-variant composition property. Adds a third mock document/document-type pair representing an invariant content type whose flattened property list contains a culture-variant property (the runtime shape produced when a variant composition is applied to an invariant content type) and a setPropertyValue test asserting the value is stored as a culture/segment-invariant entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Remove null guard for segment variant documents, as null segment is the default segment. * update mock data and tests to include real compositions --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Mads Rasmussen <madsr@hey.com>
|
Cherry picked to |
… save of default segment (closes #22800, #22865) (#22846) * Fix edit of a variant property composed to an invariant document. * Collapse multi-line guard comment to a single line per project policy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Add unit test coverage for invariant content with a culture-variant composition property. Adds a third mock document/document-type pair representing an invariant content type whose flattened property list contains a culture-variant property (the runtime shape produced when a variant composition is applied to an invariant content type) and a setPropertyValue test asserting the value is stored as a culture/segment-invariant entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Remove null guard for segment variant documents, as null segment is the default segment. * update mock data and tests to include real compositions --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Mads Rasmussen <madsr@hey.com>


Description
This PR combines two fixes that are related as coming from #22621 (Document Workspace: Add CRUD and property value tests for document workspace context, merged 2026-05-07). That PR added a guard in
UmbContentDetailWorkspaceContextBase.setPropertyValue(src/Umbraco.Web.UI.Client/src/packages/content/content/workspace/content-detail-workspace-base.ts) which throws when a caller tries to write a value for a culture- or segment-variant property without supplying a correspondingvariantId. The guard was too broad and caused two distinct user-visible regressions.Fixes #22800 and fixes #22865.
#22800 — invariant content type with a variant composition
When an invariant content type uses a composition whose property type is culture- or segment-variant, typing a value into that field and clicking Save silently discarded the value and left the previous value in place — with an unhandled promise rejection in the browser console. The guard inspected only the property type's variance and ignored the host content type's variance.
Fix: intersect the property's variance with the content type's variance. A variant property on an invariant content type is treated as invariant, so the guard no longer rejects the write.
#22865 — default segment values for segment-variant properties
For a property that varies by segment, values entered for the default segment were never saved (omitted from the save/validate payload). Values for other segments saved fine. The guard rejected the default segment because
UmbVariantId.isSegmentInvariant()returnstruewhensegment === null— but unlike culture, a null segment is the default segment, a legitimate bucket, not a missing value.Fix: drop the segment branch of the guard entirely. A null segment is always a valid value for a segment-variant property, so there is no useful safety check to express there. The culture branch is retained because a null culture genuinely is invalid on a culture-variant content type.
The first bug was reported as 18.1+ but both are present on
v17/dev, and so onrelease/17.5.0,release/18.0, andmainas well. Hence, when approved, this should be cherry-picked or merged into those branches.Testing
Automated
The unit test suite added in #22621 is extended with:
cultureandsegmentnull).All tests have been verified to fail before and pass after the fix is in place.
Manual
For #22800:
Compositionthat varies by culture, with one textstring property.Hostthat does not vary by culture, withCompositionadded as a composition.Host, type a value into the inherited property, click Save.Before the fix: value reverts; no toast; an unhandled rejection appears in the browser console:
After the fix: value is persisted.
For #22865:
ISegmentServiceexposing one or more segments (see the reproduction code in #22865) and setSegmentSettings.Enabled = true.Before the fix: the default-segment value is omitted from the save/validate network payload and not persisted.
After the fix: the default-segment value is included in the payload and persisted alongside any named-segment values.