[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

@@ -16,16 +16,16 @@
*/
import { CommentModel, CommentProcessService } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { Observable, Observer } from 'rxjs';
import { share } from 'rxjs/operators';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, OnDestroy } from '@angular/core';
import { Observable, Observer, Subject } from 'rxjs';
import { share, takeUntil } from 'rxjs/operators';
@Component({
selector: 'adf-process-instance-comments',
templateUrl: './process-comments.component.html',
styleUrls: ['./process-comments.component.scss']
})
export class ProcessCommentsComponent implements OnChanges {
export class ProcessCommentsComponent implements OnChanges, OnDestroy {
/** (**required**) The numeric ID of the process instance to display comments for. */
@Input()
@@ -44,16 +44,22 @@ export class ProcessCommentsComponent implements OnChanges {
private commentObserver: Observer<CommentModel>;
comment$: Observable<CommentModel>;
private onDestroy$ = new Subject<boolean>();
message: string;
beingAdded: boolean = false;
constructor(private commentProcessService: CommentProcessService) {
this.comment$ = new Observable<CommentModel>((observer) => this.commentObserver = observer)
.pipe(share());
this.comment$.subscribe((comment: CommentModel) => {
this.comments.push(comment);
});
this.comment$ = new Observable<CommentModel>(observer => this.commentObserver = observer).pipe(share());
this.comment$
.pipe(takeUntil(this.onDestroy$))
.subscribe(comment => this.comments.push(comment));
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
ngOnChanges(changes: SimpleChanges) {