From adbc5bde72c3c0a8522a9d8ab61c1c58ebf95db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Farkas?= Date: Mon, 29 Nov 2021 10:00:41 +0100 Subject: [PATCH] explore: fix url update inconsistency (#42288) --- public/app/features/explore/state/query.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/app/features/explore/state/query.ts b/public/app/features/explore/state/query.ts index eadb3c6e729..c1742588419 100644 --- a/public/app/features/explore/state/query.ts +++ b/public/app/features/explore/state/query.ts @@ -391,7 +391,7 @@ export const runQueries = ( const timeZone = getTimeZone(getState().user); const transaction = buildQueryTransaction(exploreId, queries, queryOptions, range, scanning, timeZone); - let firstResponse = true; + let querySaved = false; dispatch(changeLoadingStateAction({ exploreId, loadingState: LoadingState.Loading })); newQuerySub = runRequest(datasourceInstance, transaction.request) @@ -413,7 +413,7 @@ export const runQueries = ( ) .subscribe( (data) => { - if (!data.error && firstResponse) { + if (data.state !== LoadingState.Loading && !data.error && !querySaved) { // Side-effect: Saving history in localstorage const nextHistory = updateHistory(history, datasourceId, queries); const { richHistory: nextRichHistory, localStorageFull, limitExceeded } = addToRichHistory( @@ -438,10 +438,9 @@ export const runQueries = ( // We save queries to the URL here so that only successfully run queries change the URL. dispatch(stateSave({ replace: options?.replaceUrl })); + querySaved = true; } - firstResponse = false; - dispatch(queryStreamUpdatedAction({ exploreId, response: data })); // Keep scanning for results if this was the last scanning transaction