From 13840bb32ebcb2e7a10522760270f8dd655b2f0f Mon Sep 17 00:00:00 2001 From: amlmtl <> Date: Thu, 16 Nov 2023 16:32:17 +0000 Subject: [PATCH] fix: stop premature query calls during fields initialization --- src/components/QueryEditor.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/QueryEditor.tsx b/src/components/QueryEditor.tsx index 64137af..e0743c2 100644 --- a/src/components/QueryEditor.tsx +++ b/src/components/QueryEditor.tsx @@ -192,7 +192,7 @@ export class QueryEditor extends PureComponent { case EspObjectType.CONTINUOUS_QUERY: await this.setSelectedWindow(null); case EspObjectType.WINDOW: - await this.setSelectedFields([]); + await this.setSelectedFields(null); case EspObjectType.FIELD: break; } @@ -328,11 +328,13 @@ export class QueryEditor extends PureComponent { } } - 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 {