Skip to content

Commit

Permalink
fix: convert empty string value to undefined for Number Field (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
VitaliiDC8 authored Aug 25, 2023
1 parent ae89f4b commit 0724cac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/hooks/useField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ export const useField = <Value extends FieldValue, SpecType extends Spec>({
const error = validate?.(_value);
let value = transformArrIn(_value);

if (isNumberSpec(spec) && value && !error) {
value = Number(value) as Value;
if (isNumberSpec(spec) && !error) {
value = (value ? Number(value) : undefined) as Value;
}

let newChildErrors: Record<string, ValidateError> = {...state.childErrors};
Expand Down

0 comments on commit 0724cac

Please sign in to comment.