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

This commit is contained in:
Ivana Huckova 2020-01-14 19:20:17 +01:00 committed by GitHub
parent a1579283a6
commit ba7d8c1a3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -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;

View File

@ -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({