Skip to content

Commit

Permalink
fix: stop premature query calls during fields initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
amlmtl committed Nov 16, 2023
1 parent f659b7b commit 13840bb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class QueryEditor extends PureComponent<Props> {
case EspObjectType.CONTINUOUS_QUERY:
await this.setSelectedWindow(null);
case EspObjectType.WINDOW:
await this.setSelectedFields([]);
await this.setSelectedFields(null);
case EspObjectType.FIELD:
break;
}
Expand Down Expand Up @@ -328,11 +328,13 @@ export class QueryEditor extends PureComponent<Props> {
}
}

async setSelectedFields(fields: Field[]) {
await this.setStateWithPromise({selectedFields: fields})
async setSelectedFields(fields: Field[] | null) {
await this.setStateWithPromise({selectedFields: fields ?? []})

this.espQueryController.save();
this.espQueryController.execute();
if (fields != null) {
this.espQueryController.save();
this.espQueryController.execute();
}
}

private setStateWithPromise(stateDiff: {}): Promise<void> {
Expand Down

0 comments on commit 13840bb

Please sign in to comment.