Segments: Preserve segmented property values after save (closes #22166)#22173
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the content detail workspace’s incoming-data processing to avoid dropping existing server-side property values for culture+segment combinations that aren’t included in the preset builder’s variant options.
Changes:
- Merges
processedValueswith originaldata.values, preserving values not produced by the preset variant builder. - Ensures segment-specific values are retained even when variant options don’t cover all culture/segment combinations.
You can also share your feedback on Copilot code review. Take the survey.
AndyButland
added a commit
that referenced
this pull request
Apr 26, 2026
… (#22173) * Preserve segment-specific property values after save and publish. * Addressed feedback from code review. * Moved fix to a projection in UmbPropertyValuePresetVariantBuilderController. --------- Co-authored-by: Niels Lyngsø <nsl@umbraco.dk>
This was referenced Jun 26, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses #22166 which describes a situation when a property varies by segment but not by culture on a document type that varies by both, segment-specific values are silently dropped after save-and-publish because the preset builder's variant options don't include segment-only (
nullculture + segment) combinations.With the change in this PR, after
_processIncomingDataruns the preset builder, original server values not covered by variant options are now merged back, preventing data loss.Root Cause
In
content-detail-workspace-base.ts,_processIncomingDatareplacesdata.valuesentirely with the output of the preset builder. The preset builder only produces values for variant options from#getFilteredVariantOptions. For a property withvariesByCulture=false, variesBySegment=true, filtering removes all options with non-null culture (leaving only the invariant option), so all segment-specific values are dropped.Fix
After the preset builder generates
processedValues, merge them with the originaldata.values. This is done by keeping all processed values and then appending any server values that weren't already covered. Preset values take priority, and server values are only added when missing.Testing
Prerequisites: Enable segments
ISegmentServicereturning at least two segments (e.g. "VIP members" with aliasvip-members, "Recurring visitors" with aliasrecurring-visitors) — see kjac.dev/posts/umbraco-16-brings-back-segments for a walkthrough. Register with a composer.Segment service implementation
Segments composer
Setup: Create a document type and content
Reproduce the bug (without fix)
Verify the fix
Additional edge cases to verify