Commit ba7d8c1a by Ivana Huckova Committed by GitHub

Explore: Fix timepicker when browsing back after switching datasource (#21454)

parent a1579283
......@@ -31,6 +31,7 @@ import {
DataSourceApi,
PanelData,
RawTimeRange,
TimeRange,
GraphSeriesXY,
TimeZone,
AbsoluteTimeRange,
......@@ -51,6 +52,7 @@ import {
DEFAULT_RANGE,
DEFAULT_UI_STATE,
getTimeRangeFromUrl,
getTimeRange,
lastUsedDatasourceKeyForOrgId,
} from 'app/core/utils/explore';
import { Emitter } from 'app/core/utils/emitter';
......@@ -93,7 +95,7 @@ interface ExploreProps {
queryKeys: string[];
initialDatasource: string;
initialQueries: DataQuery[];
initialRange: RawTimeRange;
initialRange: TimeRange;
mode: ExploreMode;
initialUI: ExploreUIState;
isLive: boolean;
......@@ -394,7 +396,9 @@ function mapStateToProps(state: StoreState, { exploreId }: ExploreProps): Partia
{}) as ExploreUrlState;
const initialDatasource = datasource || store.get(lastUsedDatasourceKeyForOrgId(state.user.orgId));
const initialQueries: DataQuery[] = ensureQueriesMemoized(queries);
const initialRange = urlRange ? getTimeRangeFromUrlMemoized(urlRange, timeZone).raw : DEFAULT_RANGE;
const initialRange = urlRange
? getTimeRangeFromUrlMemoized(urlRange, timeZone)
: getTimeRange(timeZone, DEFAULT_RANGE);
let newMode: ExploreMode | undefined;
......
......@@ -265,7 +265,7 @@ export function initializeExplore(
exploreId: ExploreId,
datasourceName: string,
queries: DataQuery[],
rawRange: RawTimeRange,
range: TimeRange,
mode: ExploreMode,
containerWidth: number,
eventBridge: Emitter,
......@@ -273,8 +273,6 @@ export function initializeExplore(
originPanelId: number
): ThunkResult<void> {
return async (dispatch, getState) => {
const timeZone = getTimeZone(getState().user);
const range = getTimeRange(timeZone, rawRange);
dispatch(loadExploreDatasourcesAndSetDatasource(exploreId, datasourceName));
dispatch(
initializeExploreAction({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment