From fbb6efaf683a18878164da59f46acacd38b322b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 13 Feb 2020 11:10:38 +0100 Subject: [PATCH] Fix loadingIndicator in wpList component --- .../routing/wp-list/wp-list.component.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts b/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts index f29c0fa6e5..d980abf9d8 100644 --- a/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts +++ b/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts @@ -101,11 +101,8 @@ export class WorkPackagesListComponent extends WorkPackagesViewBase implements O this.hasQueryProps = !!this.$state.params.query_props; // If the query was loaded, reload invisibly - if (this.querySpace.initialized.hasValue()) { - this.refresh(); - } else { - this.loadCurrentQuery(); - } + const isFirstLoad = !this.querySpace.initialized.hasValue(); + this.refresh(isFirstLoad, isFirstLoad); // Load query on URL transitions this.updateQueryOnParamsChanges(); @@ -199,7 +196,7 @@ export class WorkPackagesListComponent extends WorkPackagesViewBase implements O let promise:Promise; if (firstPage) { - promise = this.loadCurrentQuery(); + promise = this.wpListService.loadCurrentQueryFromParams(this.projectIdentifier); } else { promise = this.wpListService.reloadCurrentResultsList(); } @@ -207,7 +204,7 @@ export class WorkPackagesListComponent extends WorkPackagesViewBase implements O if (visibly) { this.loadingIndicator = promise.then(() => { if (this.wpTableTimeline.isVisible) { - return this.querySpace.timelineRendered.toPromise(); + return this.querySpace.timelineRendered.pipe(take(1)).toPromise(); } else { return this.querySpace.tableRendered.valuesPromise() as Promise; } @@ -253,7 +250,7 @@ export class WorkPackagesListComponent extends WorkPackagesViewBase implements O this.wpListChecksumService .executeIfOutdated(newId, newChecksum, - () => this.loadCurrentQuery()); + () => this.refresh(true, true)); }); } @@ -273,9 +270,4 @@ export class WorkPackagesListComponent extends WorkPackagesViewBase implements O this.loadingIndicatorService.table.promise = promise; } - protected loadCurrentQuery():Promise { - return this.loadingIndicator = - this.wpListService - .loadCurrentQueryFromParams(this.projectIdentifier); - } }