explore: fix url update inconsistency (#42288) (#42416)

(cherry picked from commit adbc5bde72)

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-11-29 06:05:08 -05:00
committed by GitHub
co-authored by Gábor Farkas
parent 15d94f467d
commit 8ad3ab4082
+3 -4
View File
@@ -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