[#39772] removed unwanted update cycles for query title

pull/9885/head
Eric Schubert 3 years ago committed by Oliver Günther
parent fe8d6f4462
commit 38f0611a80
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 42
      frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
  2. 2
      frontend/src/app/shared/components/op-query-select/op-static-queries.service.ts

@ -100,9 +100,6 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp
showToolbarSaveButton:boolean;
/** Listener callbacks */
// eslint-disable-next-line @typescript-eslint/ban-types
unRegisterTitleListener:Function;
// eslint-disable-next-line @typescript-eslint/ban-types
removeTransitionSubscription:Function;
@ -149,24 +146,20 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp
// Load query on URL transitions
this.queryParamListener
.observe$
.pipe(
this.untilDestroyed(),
).subscribe(() => {
/** Ensure we reload the query from the changed props */
.pipe(this.untilDestroyed())
.subscribe(() => {
/** Ensure we reload the query from the changed props */
this.currentQuery = undefined;
this.refresh(true, true);
void this.refresh(true, true);
});
// Update title on entering this state
this.unRegisterTitleListener = this.$transitions.onSuccess({}, () => {
this.updateTitle(this.querySpace.query.value);
});
this.querySpace.query.values$().pipe(
this.untilDestroyed(),
).subscribe((query) => {
this.onQueryUpdated(query);
});
this.querySpace.query.values$()
.pipe(this.untilDestroyed())
.subscribe((query) => {
// Update the title whenever the query changes
this.updateTitle(query);
this.currentQuery = query;
});
}
/**
@ -175,11 +168,11 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp
*
* @param state The current or entering state
*/
protected setPartition(state:Ng2StateDeclaration) {
protected setPartition(state:Ng2StateDeclaration):void {
this.currentPartition = (state.data && state.data.partition) ? state.data.partition : '-split';
}
protected setupInformationLoadedListener() {
protected setupInformationLoadedListener():void {
this
.querySpace
.initialized
@ -191,17 +184,8 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp
});
}
protected onQueryUpdated(query:QueryResource) {
// Update the title whenever the query changes
this.updateTitle(query);
this.currentQuery = query;
this.cdRef.detectChanges();
}
ngOnDestroy():void {
super.ngOnDestroy();
this.unRegisterTitleListener();
this.removeTransitionSubscription();
this.queryParamListener.removeQueryChangeListener();
}

@ -62,7 +62,7 @@ export class StaticQueriesService {
public getStaticName(query:QueryResource):string {
if (this.$state.params.query_props) {
const queryProps = JSON.parse(this.$state.params.query_props);
const queryProps = JSON.parse(this.$state.params.query_props) as { pa:unknown, pp:unknown }&unknown;
delete queryProps.pp;
delete queryProps.pa;
const queryPropsString = JSON.stringify(queryProps);

Loading…
Cancel
Save