diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/date_picker/synthetics_date_picker.test.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/date_picker/synthetics_date_picker.test.tsx index 6fae43af920e5..a78710dd9994e 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/date_picker/synthetics_date_picker.test.tsx +++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/date_picker/synthetics_date_picker.test.tsx @@ -25,26 +25,6 @@ describe('SyntheticsDatePicker component', () => { expect(await findByText('Refresh')).toBeInTheDocument(); }); - it('uses shared date range state when there is no url date range state', async () => { - const customHistory = createMemoryHistory({ - initialEntries: ['/?dateRangeStart=now-24h&dateRangeEnd=now'], - }); - - jest.spyOn(customHistory, 'push'); - - const { findByText } = render(, { - history: customHistory, - core: startPlugins, - }); - - expect(await findByText('~ 30 minutes ago')).toBeInTheDocument(); - - expect(customHistory.push).toHaveBeenCalledWith({ - pathname: '/', - search: 'dateRangeEnd=now-15m&dateRangeStart=now-30m', - }); - }); - it('should use url date range even if shared date range is present', async () => { const customHistory = createMemoryHistory({ initialEntries: ['/?g=%22%22&dateRangeStart=now-10m&dateRangeEnd=now'], diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/date_picker/synthetics_date_picker.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/date_picker/synthetics_date_picker.tsx index 82f2874f9ffa2..a5eaeacf6c7ed 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/date_picker/synthetics_date_picker.tsx +++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/date_picker/synthetics_date_picker.tsx @@ -7,7 +7,6 @@ import React, { useContext, useEffect } from 'react'; import { EuiSuperDatePicker } from '@elastic/eui'; -import { CLIENT_DEFAULTS_SYNTHETICS } from '../../../../../../common/constants/synthetics/client_defaults'; import { useUrlParams } from '../../../hooks'; import { CLIENT_DEFAULTS } from '../../../../../../common/constants'; import { @@ -16,12 +15,6 @@ import { SyntheticsRefreshContext, } from '../../../contexts'; -const isSyntheticsDefaultDateRange = (dateRangeStart: string, dateRangeEnd: string) => { - const { DATE_RANGE_START, DATE_RANGE_END } = CLIENT_DEFAULTS_SYNTHETICS; - - return dateRangeStart === DATE_RANGE_START && dateRangeEnd === DATE_RANGE_END; -}; - export const SyntheticsDatePicker = ({ fullWidth }: { fullWidth?: boolean }) => { const [getUrlParams, updateUrl] = useUrlParams(); const { commonlyUsedRanges } = useContext(SyntheticsSettingsContext); @@ -36,10 +29,7 @@ export const SyntheticsDatePicker = ({ fullWidth }: { fullWidth?: boolean }) => useEffect(() => { const { from, to } = sharedTimeState ?? {}; - // if it's synthetics default range, and we have shared state from kibana, let's use that - if (isSyntheticsDefaultDateRange(start, end) && (from !== start || to !== end)) { - updateUrl({ dateRangeStart: from, dateRangeEnd: to }); - } else if (from !== start || to !== end) { + if (from !== start || to !== end) { // if it's coming url. let's update shared state data?.query.timefilter.timefilter.setTime({ from: start, to: end }); }