From 9246ecbb08a930eb52008cdb049c437ae0e64f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 23 Apr 2025 16:21:30 +0200 Subject: [PATCH] reject init when document-type failed to load (#19092) --- .../structure/content-type-structure-manager.class.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/structure/content-type-structure-manager.class.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/structure/content-type-structure-manager.class.ts index aaa20a0626..de142f1e7a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/content/content-type/structure/content-type-structure-manager.class.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/content/content-type/structure/content-type-structure-manager.class.ts @@ -41,8 +41,10 @@ export class UmbContentTypeStructureManager< T extends UmbContentTypeModel = UmbContentTypeModel, > extends UmbControllerBase { #initResolver?: (result: T) => void; - #init = new Promise((resolve) => { + #initRejection?: (reason: any) => void; + #init = new Promise((resolve, reject) => { this.#initResolver = resolve; + this.#initRejection = reject; }); #editedTypes = new UmbArrayState([], (x) => x); @@ -184,6 +186,7 @@ export class UmbContentTypeStructureManager< this.#clear(); this.#ownerContentTypeUnique = unique; if (!unique) { + this.#initRejection?.(`Content Type structure manager could not load: ${unique}`); return Promise.reject( new Error('The unique identifier is missing. A valid unique identifier is required to load the content type.'), ); @@ -201,7 +204,10 @@ export class UmbContentTypeStructureManager< const repsonse = await this.#repository!.createScaffold(preset); const { data } = repsonse; - if (!data) return { error: repsonse.error }; + if (!data) { + this.#initRejection?.(`Content Type structure manager could not create scaffold`); + return { error: repsonse.error }; + } this.#ownerContentTypeUnique = data.unique; @@ -790,6 +796,7 @@ export class UmbContentTypeStructureManager< } #clear() { + this.#initRejection?.(`Content Type structure manager could not load: ${this.#ownerContentTypeUnique}`); this.#init = new Promise((resolve) => { this.#initResolver = resolve; });