Update content-data-manager.ts

This commit is contained in:
Mads Rasmussen
2025-04-16 10:49:11 +02:00
parent 64915eea92
commit 63485bca15

View File

@@ -72,8 +72,6 @@ export class UmbContentWorkspaceDataManager<
if (variantId.isInvariant()) {
this.#updateInvariantData(update);
} else {
// The server requires a segment name. It doesn't matter what it is as long as it is not empty. The server will overwrite it with the name of the default.
update = { ...update, name: 'Segment' } as ModelVariantType;
this.#updateVariantData(variantId, update);
}
return;
@@ -91,6 +89,11 @@ export class UmbContentWorkspaceDataManager<
const currentData = this.getCurrent();
if (!currentData) throw new Error('Data is missing');
if (!variantId.isSegmentInvariant()) {
// The server requires a segment name. It doesn't matter what it is as long as it is not empty. The server will overwrite it with the name of the default.
update = { ...update, name: 'Segment' } as ModelVariantType;
}
const variant = currentData.variants.find((x) => variantId.compare(x));
const newVariants = appendToFrozenArray(
currentData.variants,