diff --git a/public/app/core/components/TimePicker/TimePickerWithHistory.tsx b/public/app/core/components/TimePicker/TimePickerWithHistory.tsx index f5bd5f52211e7..178bda34d01ba 100644 --- a/public/app/core/components/TimePicker/TimePickerWithHistory.tsx +++ b/public/app/core/components/TimePicker/TimePickerWithHistory.tsx @@ -65,15 +65,17 @@ export const Picker: FC = ({ rawValues, onSaveToStore, pickerProps }) ); } + } else if (fnGlobalTimeRange && !isEqual(fnGlobalTimeRange, pickerProps.value)) { + /* If fnGlobalTimeRange exists in the initial render, set the time as that */ + pickerProps.onChange(fnGlobalTimeRange); } didMountRef.current = true; - }, [dispatch, fnGlobalTimeRange?.raw, pickerProps.value]); + }, [dispatch, fnGlobalTimeRange, pickerProps]); return ( { onAppendToHistory(value, values, onSaveToStore);