Skip to content

Commit

Permalink
fix: fix the stale value issue in range picker
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadshaheer committed Dec 19, 2024
1 parent 68cead0 commit c4cc035
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/CustomTimePicker/RangePickerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ function RangePickerModal(props: RangePickerModalProps): JSX.Element {
};
const { timezone } = useTimezone();

const defaultValue = useMemo(
(): [Dayjs, Dayjs] => [
const rangeValue: [Dayjs, Dayjs] = useMemo(
() => [
dayjs(minTime / 1000_000).tz(timezone.value),
dayjs(maxTime / 1000_000).tz(timezone.value),
],
[minTime, maxTime, timezone.value],
[maxTime, minTime, timezone.value],
);

return (
Expand All @@ -78,7 +78,7 @@ function RangePickerModal(props: RangePickerModalProps): JSX.Element {
onOk={onModalOkHandler}
// eslint-disable-next-line react/jsx-props-no-spreading
{...(selectedTime === 'custom' && {
defaultValue,
value: rangeValue,
})}
/>
</div>
Expand Down

0 comments on commit c4cc035

Please sign in to comment.