@@ -283,7 +283,7 @@ export abstract class UmbContentDetailWorkspaceContextBase<
283
283
await this . structure . loadType ( ( data as any ) [ this . #contentTypePropertyName] . unique ) ;
284
284
285
285
// Set culture and segment for all values:
286
- const cutlures = this . #languages. getValue ( ) . map ( ( x ) => x . unique ) ;
286
+ const cultures = this . #languages. getValue ( ) . map ( ( x ) => x . unique ) ;
287
287
288
288
if ( this . structure . variesBySegment ) {
289
289
console . warn ( 'Segments are not yet implemented for preset' ) ;
@@ -319,11 +319,28 @@ export abstract class UmbContentDetailWorkspaceContextBase<
319
319
) ;
320
320
321
321
const controller = new UmbPropertyValuePresetVariantBuilderController ( this ) ;
322
- controller . setCultures ( cutlures ) ;
322
+ controller . setCultures ( cultures ) ;
323
323
if ( segments ) {
324
324
controller . setSegments ( segments ) ;
325
325
}
326
- data . values = await controller . create ( valueDefinitions ) ;
326
+
327
+ const presetValues = await controller . create ( valueDefinitions ) ;
328
+
329
+ // Don't just set the values, as we could have some already populated from a blueprint.
330
+ // If we have a value from both a blueprint and a preset, use the latter as priority.
331
+ const dataValues = [ ...data . values ] ;
332
+ for ( let index = 0 ; index < presetValues . length ; index ++ ) {
333
+ const presetValue = presetValues [ index ] ;
334
+ const variantId = UmbVariantId . Create ( presetValue ) ;
335
+ const matchingDataValueIndex = dataValues . findIndex ( ( v ) => v . alias === presetValue . alias && variantId . compare ( v ) ) ;
336
+ if ( matchingDataValueIndex > - 1 ) {
337
+ dataValues [ matchingDataValueIndex ] = presetValue ;
338
+ } else {
339
+ dataValues . push ( presetValue ) ;
340
+ }
341
+ }
342
+
343
+ data . values = dataValues ;
327
344
328
345
return data ;
329
346
}
0 commit comments