createContainer shuld duplicate none owner parent containers (#18462)

This commit is contained in:
Niels Lyngsø
2025-02-26 09:29:36 +01:00
committed by GitHub
parent 40fc911234
commit afe4a56ca7

View File

@@ -375,7 +375,6 @@ export class UmbContentTypeStructureManager<
...(this.#contentTypes.getValue().find((x) => x.unique === toContentTypeUnique)?.containers ?? []),
];
//.filter((x) => x.name !== clonedContainer.name && x.type === clonedContainer.type);
containers.push(clonedContainer);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -411,6 +410,14 @@ export class UmbContentTypeStructureManager<
await this.#init;
contentTypeUnique = contentTypeUnique ?? this.#ownerContentTypeUnique!;
if (parentId) {
const duplicatedParentContainer = await this.ensureContainerOf(parentId, contentTypeUnique);
if (!duplicatedParentContainer) {
throw new Error('Parent container for creating a new container could not be found or created');
}
parentId = duplicatedParentContainer.id;
}
const container: UmbPropertyTypeContainerModel = {
id: UmbId.new(),
parent: parentId ? { id: parentId } : null,