[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:
Denys Vuika
2019-07-16 15:56:00 +01:00
committed by Eugenio Romano
parent e2311ab045
commit 1abb9bfc89
98 changed files with 1581 additions and 1066 deletions

View File

@@ -22,13 +22,15 @@ import {
OnChanges,
OnInit,
Output,
SimpleChanges,
ViewChild,
ViewEncapsulation
ViewEncapsulation,
OnDestroy
} from '@angular/core';
import { MatSelect } from '@angular/material';
import { Node, PathElementEntity } from '@alfresco/js-api';
import { DocumentListComponent } from '../document-list';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@Component({
selector: 'adf-breadcrumb',
@@ -39,7 +41,7 @@ import { DocumentListComponent } from '../document-list';
'class': 'adf-breadcrumb'
}
})
export class BreadcrumbComponent implements OnInit, OnChanges {
export class BreadcrumbComponent implements OnInit, OnChanges, OnDestroy {
/** Active node, builds UI based on folderNode.path.elements collection. */
@Input()
@@ -84,6 +86,8 @@ export class BreadcrumbComponent implements OnInit, OnChanges {
route: PathElementEntity[] = [];
private onDestroy$ = new Subject<boolean>();
get hasRoot(): boolean {
return !!this.root;
}
@@ -96,14 +100,16 @@ export class BreadcrumbComponent implements OnInit, OnChanges {
this.transform = this.transform ? this.transform : null;
if (this.target) {
this.target.$folderNode.subscribe((folderNode: Node) => {
this.folderNode = folderNode;
this.recalculateNodes();
});
this.target.$folderNode
.pipe(takeUntil(this.onDestroy$))
.subscribe((folderNode: Node) => {
this.folderNode = folderNode;
this.recalculateNodes();
});
}
}
ngOnChanges(changes: SimpleChanges): void {
ngOnChanges(): void {
this.recalculateNodes();
}
@@ -184,4 +190,9 @@ export class BreadcrumbComponent implements OnInit, OnChanges {
}
}
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
}