mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +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,7 +22,8 @@ import { UploadService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { PreviewService } from '../../services/preview.service';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
export function processUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService) {
|
||||
return new ProcessUploadService(api, config);
|
||||
@@ -51,7 +52,7 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy
|
||||
|
||||
processInstance: ProcessInstance;
|
||||
|
||||
private subscriptions: Subscription[] = [];
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
private uploadService: UploadService,
|
||||
@@ -60,11 +61,9 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(
|
||||
this.uploadService.fileUploadComplete.subscribe(
|
||||
(value) => this.onFileUploadComplete(value.data)
|
||||
)
|
||||
);
|
||||
this.uploadService.fileUploadComplete
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(value => this.onFileUploadComplete(value.data));
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
@@ -77,8 +76,8 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
||||
this.subscriptions = [];
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onFileUploadComplete(content: any) {
|
||||
|
Reference in New Issue
Block a user