[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

@@ -20,7 +20,8 @@ import { Router, ActivatedRoute, Params } from '@angular/router';
import { NodePaging, Pagination, ResultSetPaging } from '@alfresco/js-api';
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { UserPreferencesService, SearchService, AppConfigService } from '@alfresco/adf-core';
import { Subscription } from 'rxjs';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@Component({
selector: 'app-search-result-component',
@@ -38,7 +39,7 @@ export class SearchResultComponent implements OnInit, OnDestroy {
sorting = ['name', 'asc'];
private subscriptions: Subscription[] = [];
private onDestroy$ = new Subject<boolean>();
constructor(public router: Router,
private config: AppConfigService,
@@ -55,19 +56,21 @@ export class SearchResultComponent implements OnInit, OnDestroy {
this.sorting = this.getSorting();
this.subscriptions.push(
this.queryBuilder.updated.subscribe(() => {
this.queryBuilder.updated
.pipe(takeUntil(this.onDestroy$))
.subscribe(() => {
this.sorting = this.getSorting();
this.isLoading = true;
}),
});
this.queryBuilder.executed.subscribe((resultSetPaging: ResultSetPaging) => {
this.queryBuilder.executed
.pipe(takeUntil(this.onDestroy$))
.subscribe((resultSetPaging: ResultSetPaging) => {
this.queryBuilder.paging.skipCount = 0;
this.onSearchResultLoaded(resultSetPaging);
this.isLoading = false;
})
);
});
if (this.route) {
this.route.params.forEach((params: Params) => {
@@ -102,8 +105,8 @@ export class SearchResultComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
this.subscriptions = [];
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
onSearchResultLoaded(resultSetPaging: ResultSetPaging) {