Skip to content

Commit

Permalink
🎨 Invoke with 0 when nullable option disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kemuridama committed Apr 24, 2024
1 parent 3b552c7 commit 9bbd8c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lv2/formFields/DigitsInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ const useHandlers = ({
if (onChange) {
const numValue = Digits.numberize(Ascii.zenkakuToHankaku(origValue));

// Invokes `onChange()` handler with `null` if the parsed input value is not a finite number.
// Invokes `onChange()` handler with `null` or `0` if the parsed input value is not a finite number.
if (!Number.isFinite(numValue)) {
return onChange(null);
return onChange(nullable ? null : 0);
}

onChange(nullable && !origValue ? null : sliceDecimal(numValue));
Expand Down

0 comments on commit 9bbd8c7

Please sign in to comment.