mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4745] memory leak fixes (#4931)
* fix app-layout component * fix card-view component * fix cloud-layout service * code fixes * code fixes * even more fixes * even more fixes * lint fixes * test fixes * fix code * remove useless pipes * fix code owners * enable spellcheck for cloud components * update test * update test
This commit is contained in:
committed by
Eugenio Romano
parent
e2311ab045
commit
1abb9bfc89
@@ -15,13 +15,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AfterContentInit, ContentChild, Directive, Input, TemplateRef } from '@angular/core';
|
||||
import { AfterContentInit, ContentChild, Directive, Input, TemplateRef, OnDestroy } from '@angular/core';
|
||||
import { ViewerComponent } from '../components/viewer.component';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Directive({
|
||||
selector: 'adf-viewer-extension'
|
||||
})
|
||||
export class ViewerExtensionDirective implements AfterContentInit {
|
||||
export class ViewerExtensionDirective implements AfterContentInit, OnDestroy {
|
||||
|
||||
@ContentChild(TemplateRef)
|
||||
template: any;
|
||||
@@ -37,6 +39,8 @@ export class ViewerExtensionDirective implements AfterContentInit {
|
||||
|
||||
templateModel: any;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private viewerComponent: ViewerComponent) {
|
||||
}
|
||||
|
||||
@@ -45,9 +49,11 @@ export class ViewerExtensionDirective implements AfterContentInit {
|
||||
|
||||
this.viewerComponent.extensionTemplates.push(this.templateModel);
|
||||
|
||||
this.viewerComponent.extensionChange.subscribe((fileExtension) => {
|
||||
this.templateModel.isVisible = this.isVisible(fileExtension);
|
||||
});
|
||||
this.viewerComponent.extensionChange
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(fileExtension => {
|
||||
this.templateModel.isVisible = this.isVisible(fileExtension);
|
||||
});
|
||||
|
||||
if (this.supportedExtensions instanceof Array) {
|
||||
this.supportedExtensions.forEach((extension) => {
|
||||
@@ -56,6 +62,11 @@ export class ViewerExtensionDirective implements AfterContentInit {
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
/**
|
||||
* check if the current extension in the viewer is compatible with this extension checking against supportedExtensions
|
||||
*/
|
||||
|
Reference in New Issue
Block a user