File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
containers/Tenant/Query/QueryEditor Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,9 @@ export default function QueryEditor(props: QueryEditorProps) {
144
144
}
145
145
const queryId = uuidv4 ( ) ;
146
146
147
+ // Abort previous query if there was any
148
+ queryManagerInstance . abortQuery ( ) ;
149
+
147
150
if ( isStreamingEnabled ) {
148
151
const query = streamQuery ( {
149
152
actionType : 'execute' ,
Original file line number Diff line number Diff line change @@ -296,6 +296,10 @@ export const queryApi = api.injectEndpoints({
296
296
return { data : null } ;
297
297
} catch ( error ) {
298
298
const state = getState ( ) as RootState ;
299
+ if ( state . query . result ?. startTime !== startTime ) {
300
+ // This query is no longer current, don't update state
301
+ return { error} ;
302
+ }
299
303
dispatch (
300
304
setQueryResult ( {
301
305
...state . query . result ,
@@ -321,7 +325,7 @@ export const queryApi = api.injectEndpoints({
321
325
enableTracingLevel,
322
326
queryId,
323
327
} ,
324
- { signal, dispatch} ,
328
+ { signal, dispatch, getState } ,
325
329
) => {
326
330
const startTime = Date . now ( ) ;
327
331
dispatch (
@@ -410,6 +414,11 @@ export const queryApi = api.injectEndpoints({
410
414
) ;
411
415
return { data : null } ;
412
416
} catch ( error ) {
417
+ const state = getState ( ) as RootState ;
418
+ if ( state . query . result ?. startTime !== startTime ) {
419
+ // This query is no longer current, don't update state
420
+ return { error} ;
421
+ }
413
422
dispatch (
414
423
setQueryResult ( {
415
424
type : actionType ,
You can’t perform that action at this time.
0 commit comments