Skip to content

Conversation

nielslyngsoe
Copy link
Member

@nielslyngsoe nielslyngsoe commented Sep 23, 2025

Merge this first: #20228

Run Value Presets on load, to cover a case of Document with Variants where only one or some of the Variants was saved when the Document got Created.

In that case the Preset Values that was generated for the not-saved variants will when have been forgotten and never return, until this feature. So with this when you only save or save & publish one variant you will see that the others, after a refresh will get Preset Values generated.

Illustrated below:
image

This also means Presets will run if there is no value stored — still not a fallback value.

It will also cover the case of adding a new Property to an existing Document-Type, the new property will, until saved for the given Variant, be given a generated value from the Value Preset Manager.

@Copilot Copilot AI review requested due to automatic review settings September 23, 2025 18:55
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

This PR implements value preset generation on load to handle document variants where only some variants were saved during creation. This ensures that new properties added to existing document types and unsaved variants receive appropriate preset values when the workspace loads.

Key changes:

  • Modified property value preset generation to run on data load instead of only during creation
  • Enhanced slider property editor with improved type safety and form validation
  • Updated workspace context to process incoming data through value presets

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
slider/types.ts Extracts slider value object interface for better type safety
slider/property-editor-ui-slider.element.ts Adds form control mixing, improves value handling and type safety
entity-detail-workspace-base.ts Adds _processIncomingData method to handle data processing on load
property-value-preset/types.ts Adds value field to API call arguments for existing value awareness
property-value-preset-variant-builder.controller.ts Updates to pass existing values to preset generation
property-value-preset-variant-builder.controller.test.ts Adds test coverage for preset value handling with existing values
property-value-preset-builder.controller.ts Implements logic to only generate presets when value is undefined
input-slider/input-slider.element.ts Enhances slider component with validation and form control support
input-number-range/input-number-range.element.ts Updates validation message to use localization key
content-detail-workspace-base.ts Implements _processIncomingData to run presets on load with existing values
content-detail-validation-path-translator.test.ts Removes deprecated entityType from test data
content/types.ts Marks entityType as deprecated in UmbElementValueModel
content-type-workspace-context-base.ts Adds _processIncomingData call to scaffold method
localization.controller.ts Adds JSDoc examples for term method usage
lang/en.ts Adds new validation message for range exceeding validation

return this.localize.term('validation_numberMaximum', [this.max?.toString()]);
},
() => {
if (this.min !== undefined) {
Copy link
Preview

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The condition should check this.max instead of this.min for the rangeOverflow validator. This will cause the validator to never trigger when values exceed the maximum.

Suggested change
if (this.min !== undefined) {
if (this.max !== undefined) {

Copilot uses AI. Check for mistakes.

alias: propertyType.alias,
value,
} satisfies UmbPropertyValueDataPotentiallyWithEditorAlias as ReturnType;
} satisfies UmbPropertyValueDataPotentiallyWithEditorAlias as UmbPropertyValueDataPotentiallyWithEditorAlias as ReturnType;
Copy link
Preview

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

This line contains redundant type casting with as UmbPropertyValueDataPotentiallyWithEditorAlias appearing twice. Remove the duplicate cast.

Suggested change
} satisfies UmbPropertyValueDataPotentiallyWithEditorAlias as UmbPropertyValueDataPotentiallyWithEditorAlias as ReturnType;
} satisfies UmbPropertyValueDataPotentiallyWithEditorAlias as ReturnType;

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant