Skip to content

Commit

Permalink
fix(time-picker): error (#2235)
Browse files Browse the repository at this point in the history
Co-authored-by: chen_gh <[email protected]>
  • Loading branch information
gh2049 and chen_gh authored Sep 9, 2024
1 parent a265659 commit 07a7aa4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/static-past-time-picker/StaticPastTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ function StaticPastTimePicker({
],
[experimental, localLocale]
);
const options = useMemo(() => quickOptions || localQuickOptions, [quickOptions, localQuickOptions]);

earliestApprove && options.push({ value: 'earliest', label: localLocale.earliestInHistory });
const options = useMemo(
() => [
...(quickOptions || localQuickOptions),
...(earliestApprove ? [{ value: 'earliest', label: localLocale.earliestInHistory }] : []),
],
[quickOptions, localQuickOptions, earliestApprove, localLocale]
);

const parseMode = useCallback((current: string | undefined) => parseTimeMode(current, options), [options]);
const originMode = (parseMode(timeRange) ?? TimeMode.Quick) as TimeMode;
Expand Down

0 comments on commit 07a7aa4

Please sign in to comment.