mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
(cherry picked from commit adbc5bde72
)
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
parent
15d94f467d
commit
8ad3ab4082
@ -391,7 +391,7 @@ export const runQueries = (
|
|||||||
const timeZone = getTimeZone(getState().user);
|
const timeZone = getTimeZone(getState().user);
|
||||||
const transaction = buildQueryTransaction(exploreId, queries, queryOptions, range, scanning, timeZone);
|
const transaction = buildQueryTransaction(exploreId, queries, queryOptions, range, scanning, timeZone);
|
||||||
|
|
||||||
let firstResponse = true;
|
let querySaved = false;
|
||||||
dispatch(changeLoadingStateAction({ exploreId, loadingState: LoadingState.Loading }));
|
dispatch(changeLoadingStateAction({ exploreId, loadingState: LoadingState.Loading }));
|
||||||
|
|
||||||
newQuerySub = runRequest(datasourceInstance, transaction.request)
|
newQuerySub = runRequest(datasourceInstance, transaction.request)
|
||||||
@ -413,7 +413,7 @@ export const runQueries = (
|
|||||||
)
|
)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(data) => {
|
(data) => {
|
||||||
if (!data.error && firstResponse) {
|
if (data.state !== LoadingState.Loading && !data.error && !querySaved) {
|
||||||
// Side-effect: Saving history in localstorage
|
// Side-effect: Saving history in localstorage
|
||||||
const nextHistory = updateHistory(history, datasourceId, queries);
|
const nextHistory = updateHistory(history, datasourceId, queries);
|
||||||
const { richHistory: nextRichHistory, localStorageFull, limitExceeded } = addToRichHistory(
|
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.
|
// We save queries to the URL here so that only successfully run queries change the URL.
|
||||||
dispatch(stateSave({ replace: options?.replaceUrl }));
|
dispatch(stateSave({ replace: options?.replaceUrl }));
|
||||||
|
querySaved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
firstResponse = false;
|
|
||||||
|
|
||||||
dispatch(queryStreamUpdatedAction({ exploreId, response: data }));
|
dispatch(queryStreamUpdatedAction({ exploreId, response: data }));
|
||||||
|
|
||||||
// Keep scanning for results if this was the last scanning transaction
|
// Keep scanning for results if this was the last scanning transaction
|
||||||
|
Loading…
Reference in New Issue
Block a user