Skip to content

Commit f26a861

Browse files
Attila Csehpsychedelicious
authored andcommitted
value parsing refactored
1 parent 6024997 commit f26a861

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/components/number-input/composite-number-input.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,14 @@ export const CompositeNumberInput: ComponentWithAs<
8686

8787
const pushLocalValue = useCallback(() => {
8888
let localValueAsNumber = Number(localValue);
89+
8990
if (isNaN(localValueAsNumber)) {
9091
localValueAsNumber = mexp.eval(localValue);
91-
}
9292

93-
if (isNaN(localValueAsNumber)) {
94-
setLocalValue(String(isNumber(defaultValue) ? defaultValue : min));
95-
return;
93+
if (isNaN(localValueAsNumber)) {
94+
setLocalValue(String(isNumber(defaultValue) ? defaultValue : min));
95+
return;
96+
}
9697
}
9798

9899
// Otherwise, we round the value to the nearest multiple if integer, else 3 decimals

0 commit comments

Comments
 (0)