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
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user