diff --git a/src/app/shared/theme-support/themed.component.ts b/src/app/shared/theme-support/themed.component.ts index 1df7f77f08..d67efcb5bd 100644 --- a/src/app/shared/theme-support/themed.component.ts +++ b/src/app/shared/theme-support/themed.component.ts @@ -60,7 +60,6 @@ export abstract class ThemedComponent implements OnInit, OnDestroy, OnChanges } ngOnInit(): void { - this.destroyComponentInstance(); this.initComponentInstance(); } @@ -81,8 +80,6 @@ export abstract class ThemedComponent implements OnInit, OnDestroy, OnChanges } if (hasNoValue(this.lazyLoadObs)) { - this.destroyComponentInstance(); - this.lazyLoadObs = combineLatest([ observableOf(changes), this.resolveThemedComponent(this.themeService.getThemeName()).pipe( @@ -104,6 +101,7 @@ export abstract class ThemedComponent implements OnInit, OnDestroy, OnChanges } this.lazyLoadSub = this.lazyLoadObs.subscribe(([simpleChanges, constructor]: [SimpleChanges, GenericConstructor]) => { + this.destroyComponentInstance(); const factory = this.resolver.resolveComponentFactory(constructor); this.compRef = this.vcr.createComponent(factory); if (hasValue(simpleChanges)) {