Merge branch 'fix-ngonchanges-not-working-for-themed-components_contribute-7.2' into fix-ngonchanges-not-working-for-themed-components_contribute-7.4

This commit is contained in:
Alexandre Vryghem
2023-07-24 23:43:10 +02:00

View File

@@ -60,7 +60,6 @@ export abstract class ThemedComponent<T> implements OnInit, OnDestroy, OnChanges
} }
ngOnInit(): void { ngOnInit(): void {
this.destroyComponentInstance();
this.initComponentInstance(); this.initComponentInstance();
} }
@@ -81,8 +80,6 @@ export abstract class ThemedComponent<T> implements OnInit, OnDestroy, OnChanges
} }
if (hasNoValue(this.lazyLoadObs)) { if (hasNoValue(this.lazyLoadObs)) {
this.destroyComponentInstance();
this.lazyLoadObs = combineLatest([ this.lazyLoadObs = combineLatest([
observableOf(changes), observableOf(changes),
this.resolveThemedComponent(this.themeService.getThemeName()).pipe( this.resolveThemedComponent(this.themeService.getThemeName()).pipe(
@@ -104,6 +101,7 @@ export abstract class ThemedComponent<T> implements OnInit, OnDestroy, OnChanges
} }
this.lazyLoadSub = this.lazyLoadObs.subscribe(([simpleChanges, constructor]: [SimpleChanges, GenericConstructor<T>]) => { this.lazyLoadSub = this.lazyLoadObs.subscribe(([simpleChanges, constructor]: [SimpleChanges, GenericConstructor<T>]) => {
this.destroyComponentInstance();
const factory = this.resolver.resolveComponentFactory(constructor); const factory = this.resolver.resolveComponentFactory(constructor);
this.compRef = this.vcr.createComponent(factory); this.compRef = this.vcr.createComponent(factory);
if (hasValue(simpleChanges)) { if (hasValue(simpleChanges)) {