diff --git a/frontend/src/components/tools/shared/NumberInputWithUnit.tsx b/frontend/src/components/tools/shared/NumberInputWithUnit.tsx index 1a7830ad1..4e30c40d1 100644 --- a/frontend/src/components/tools/shared/NumberInputWithUnit.tsx +++ b/frontend/src/components/tools/shared/NumberInputWithUnit.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState, useEffect } from "react"; import { Stack, Text, NumberInput } from "@mantine/core"; interface NumberInputWithUnitProps { @@ -20,14 +20,26 @@ const NumberInputWithUnit = ({ max, disabled = false }: NumberInputWithUnitProps) => { + const [localValue, setLocalValue] = useState(value); + + // Sync local value when external value changes + useEffect(() => { + setLocalValue(value); + }, [value]); + + const handleBlur = () => { + onChange(localValue); + }; + return ( {label}