mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
101577: Ensure the component is always destroyed before rendering the new component
This commit is contained in:

committed by
Tim Donohue

parent
0e289b3f39
commit
4e14bc0b78
@@ -75,7 +75,6 @@ export abstract class ThemedComponent<T> implements AfterViewInit, OnDestroy, On
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.destroyComponentInstance();
|
||||
this.initComponentInstance();
|
||||
}
|
||||
|
||||
@@ -96,8 +95,6 @@ export abstract class ThemedComponent<T> implements AfterViewInit, OnDestroy, On
|
||||
}
|
||||
|
||||
if (hasNoValue(this.lazyLoadObs)) {
|
||||
this.destroyComponentInstance();
|
||||
|
||||
this.lazyLoadObs = combineLatest([
|
||||
observableOf(changes),
|
||||
this.resolveThemedComponent(this.themeService.getThemeName()).pipe(
|
||||
@@ -120,6 +117,7 @@ export abstract class ThemedComponent<T> implements AfterViewInit, OnDestroy, On
|
||||
}
|
||||
|
||||
this.lazyLoadSub = this.lazyLoadObs.subscribe(([simpleChanges, constructor]: [SimpleChanges, GenericConstructor<T>]) => {
|
||||
this.destroyComponentInstance();
|
||||
const factory = this.resolver.resolveComponentFactory(constructor);
|
||||
this.compRef = this.vcr.createComponent(factory, undefined, undefined, [this.themedElementContent.nativeElement.childNodes]);
|
||||
if (hasValue(simpleChanges)) {
|
||||
|
Reference in New Issue
Block a user