make sure to clean up

This commit is contained in:
Niels Lyngsø
2024-04-10 22:12:49 +02:00
parent 418196cc6c
commit e30a1891d3
2 changed files with 7 additions and 0 deletions

View File

@@ -176,6 +176,12 @@ export abstract class UmbBaseExtensionInitializer<
configsOfThisType.map((conditionConfig) => this.#createConditionController(conditionManifest, conditionConfig)),
);
// If we got destroyed in the mean time, then we don't need to continue:
if (!this.#extensionRegistry) {
newConditionControllers.forEach((controller) => controller?.destroy());
return;
}
const oldLength = this.#conditionControllers.length;
newConditionControllers

View File

@@ -153,6 +153,7 @@ export class UmbExtensionWithApiSlotElement extends UmbLitElement {
}
#observeExtensions(): void {
// We want to be attached before we start observing extensions, cause first at this point we know that we got the right properties. [NL]
if (!this.#attached) return;
this.#extensionsController?.destroy();
if (this.#type) {