From f4386f0308541a4241b77be45e1c3955ed21aafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 29 Nov 2019 14:52:16 +0100 Subject: [PATCH 1/2] [31698] Check if querySpace is initialized already to avoid reloading https://community.openproject.com/wp/31698 --- .../work_packages/routing/wp-list/wp-list.component.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 415e25071d..c37d2b064b 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 @@ -99,8 +99,10 @@ export class WorkPackagesListComponent extends WorkPackagesViewBase implements O this.hasQueryProps = !!this.$state.params.query_props; - // Load query initially - this.loadCurrentQuery(); + // Load query initially unless it already was loaded + if (!this.querySpace.initialized.hasValue()) { + this.loadCurrentQuery(); + } // Load query on URL transitions this.updateQueryOnParamsChanges(); From 7e51b3a1ba8311b75b62dd42ef1d06672c2916c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 2 Dec 2019 14:45:20 +0100 Subject: [PATCH 2/2] Ensure we redraw the latest version from cache --- frontend/src/app/components/states/state-cache.service.ts | 7 +++++++ frontend/src/app/components/wp-fast-table/wp-fast-table.ts | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/frontend/src/app/components/states/state-cache.service.ts b/frontend/src/app/components/states/state-cache.service.ts index 1180d09de1..1a0bfd580e 100644 --- a/frontend/src/app/components/states/state-cache.service.ts +++ b/frontend/src/app/components/states/state-cache.service.ts @@ -49,6 +49,13 @@ export abstract class StateCacheService { state.putValue(state.value, 'Touching the state'); } + /** + * Get the current value + */ + public current(id:string, fallback?:T):T|undefined { + return this.state(id).getValueOr(fallback); + } + /** * Update the value due to application changes. * diff --git a/frontend/src/app/components/wp-fast-table/wp-fast-table.ts b/frontend/src/app/components/wp-fast-table/wp-fast-table.ts index e188366d49..8c745b9980 100644 --- a/frontend/src/app/components/wp-fast-table/wp-fast-table.ts +++ b/frontend/src/app/components/wp-fast-table/wp-fast-table.ts @@ -77,6 +77,10 @@ export class WorkPackageTable { this.originalRowIndex = {}; this.originalRows = rows.map((wp:WorkPackageResource, i:number) => { let wpId = wp.id!; + + // Ensure we get the latest version + wp = this.wpCacheService.current(wpId, wp)!; + this.originalRowIndex[wpId] = {object: wp, workPackageId: wpId, position: i}; return wpId; });