diff --git a/app/assets/javascripts/directives/views/componentView.ts b/app/assets/javascripts/directives/views/componentView.ts index 5b593cee7..03c71afba 100644 --- a/app/assets/javascripts/directives/views/componentView.ts +++ b/app/assets/javascripts/directives/views/componentView.ts @@ -55,11 +55,15 @@ class ComponentViewCtrl implements ComponentViewScope { } $onDestroy() { - this.application.componentManager.onComponentIframeDestroyed(this.component.uuid); + if(this.application.componentManager) { + /** Component manager Can be destroyed already via locking */ + this.application.componentManager.onComponentIframeDestroyed(this.component.uuid); + if(this.templateComponent) { + this.application.componentManager.removeTemporaryTemplateComponent(this.templateComponent); + } + } if(this.liveComponent) { this.liveComponent.deinit(); - } else { - this.application.componentManager.removeTemporaryTemplateComponent(this.templateComponent); } this.cleanUpOn(); (this.cleanUpOn as any) = undefined; diff --git a/app/assets/javascripts/services/themeManager.ts b/app/assets/javascripts/services/themeManager.ts index f285ff143..9f97bb5db 100644 --- a/app/assets/javascripts/services/themeManager.ts +++ b/app/assets/javascripts/services/themeManager.ts @@ -35,6 +35,7 @@ export class ThemeManager extends ApplicationService { } deinit() { + this.clearAppThemeState(); this.unsubState?.(); (this.unsubState as any) = undefined; this.activeThemes.length = 0; @@ -89,10 +90,14 @@ export class ThemeManager extends ApplicationService { }) } - private deactivateAllThemes() { + private clearAppThemeState() { for (const uuid of this.activeThemes) { this.deactivateTheme(uuid, false); } + } + + private deactivateAllThemes() { + this.clearAppThemeState(); this.activeThemes = []; this.decacheThemes(); } diff --git a/dist/@types/app/assets/javascripts/services/themeManager.d.ts b/dist/@types/app/assets/javascripts/services/themeManager.d.ts index 8faccbf8a..a203b3f18 100644 --- a/dist/@types/app/assets/javascripts/services/themeManager.d.ts +++ b/dist/@types/app/assets/javascripts/services/themeManager.d.ts @@ -12,6 +12,7 @@ export declare class ThemeManager extends ApplicationService { onAppStart(): Promise; private activateCachedThemes; private registerObservers; + private clearAppThemeState; private deactivateAllThemes; private activateTheme; private deactivateTheme;