Merge pull request #7909 from opf/fix/31698/check-if-table-was-loaded

[31698] Check if querySpace is initialized already to avoid reloading
pull/7915/head
Henriette Dinger 5 years ago committed by GitHub
commit 4774d2afdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      frontend/src/app/components/states/state-cache.service.ts
  2. 4
      frontend/src/app/components/wp-fast-table/wp-fast-table.ts
  3. 6
      frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts

@ -49,6 +49,13 @@ export abstract class StateCacheService<T> {
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.
*

@ -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] = <WorkPackageTableRow>{object: wp, workPackageId: wpId, position: i};
return wpId;
});

@ -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();

Loading…
Cancel
Save