diff --git a/js/apps/admin-ui/src/components/time-selector/TimeSelector.tsx b/js/apps/admin-ui/src/components/time-selector/TimeSelector.tsx index 15f1de154e..59d6b5355a 100644 --- a/js/apps/admin-ui/src/components/time-selector/TimeSelector.tsx +++ b/js/apps/admin-ui/src/components/time-selector/TimeSelector.tsx @@ -60,6 +60,8 @@ export const TimeSelector = ({ }: TimeSelectorProps) => { const { t } = useTranslation(); + const [lastMultiplier, setLastMultiplier] = useState(); + const defaultMultiplier = useMemo( () => allTimes.find((time) => time.unit === units[0])?.multiplier, [units], @@ -88,9 +90,11 @@ export const TimeSelector = ({ if (value) { setMultiplier(multiplier); setTimeValue(value / multiplier); + setLastMultiplier(multiplier); } else { setTimeValue(value || ""); - setMultiplier(defaultMultiplier); + setMultiplier(lastMultiplier ?? defaultMultiplier); + setLastMultiplier(lastMultiplier ?? defaultMultiplier); } }, [value, defaultMultiplier]);