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