diff --git a/public/app/features/explore/state/actionTypes.ts b/public/app/features/explore/state/actionTypes.ts index aec004286a8..9b247c456b0 100644 --- a/public/app/features/explore/state/actionTypes.ts +++ b/public/app/features/explore/state/actionTypes.ts @@ -220,6 +220,7 @@ export interface LoadExploreDataSourcesPayload { export interface RunQueriesPayload { exploreId: ExploreId; + range: TimeRange; } /** diff --git a/public/app/features/explore/state/actions.ts b/public/app/features/explore/state/actions.ts index 0a430725155..c6e8827a57d 100644 --- a/public/app/features/explore/state/actions.ts +++ b/public/app/features/explore/state/actions.ts @@ -559,6 +559,7 @@ export function runQueries(exploreId: ExploreId, ignoreUIState = false): ThunkRe supportsTable, datasourceError, containerWidth, + range, } = getState().explore[exploreId]; if (datasourceError) { @@ -576,7 +577,10 @@ export function runQueries(exploreId: ExploreId, ignoreUIState = false): ThunkRe // but we're using the datasource interval limit for now const interval = datasourceInstance.interval; - dispatch(runQueriesAction({ exploreId })); + const timeZone = getTimeZone(getState().user); + const updatedRange = getTimeRange(timeZone, range.raw); + + dispatch(runQueriesAction({ exploreId, range: updatedRange })); // Keep table queries first since they need to return quickly const tableQueriesPromise = (ignoreUIState || showingTable) && supportsTable diff --git a/public/app/features/explore/state/reducers.ts b/public/app/features/explore/state/reducers.ts index c63b5fe4a1c..7f50d612abd 100644 --- a/public/app/features/explore/state/reducers.ts +++ b/public/app/features/explore/state/reducers.ts @@ -568,8 +568,9 @@ export const itemReducer = reducerFactory({} as ExploreItemSta }) .addMapper({ filter: runQueriesAction, - mapper: (state): ExploreItemState => { - const { range, datasourceInstance, containerWidth } = state; + mapper: (state, action): ExploreItemState => { + const { range } = action.payload; + const { datasourceInstance, containerWidth } = state; let interval = '1s'; if (datasourceInstance && datasourceInstance.interval) { interval = datasourceInstance.interval; @@ -577,6 +578,7 @@ export const itemReducer = reducerFactory({} as ExploreItemSta const queryIntervals = getIntervals(range, interval, containerWidth); return { ...state, + range, queryIntervals, }; },