From 0724caca315d81c8fdb047351b3bb56356f241ea Mon Sep 17 00:00:00 2001 From: VitaliiDC8 <127111625+VitaliiDC8@users.noreply.github.com> Date: Fri, 25 Aug 2023 11:10:58 +0200 Subject: [PATCH] fix: convert empty string value to undefined for Number Field (#90) --- src/lib/core/components/Form/hooks/useField.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/core/components/Form/hooks/useField.tsx b/src/lib/core/components/Form/hooks/useField.tsx index e3bdb4d7..525a95f5 100644 --- a/src/lib/core/components/Form/hooks/useField.tsx +++ b/src/lib/core/components/Form/hooks/useField.tsx @@ -95,8 +95,8 @@ export const useField = ({ 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 = {...state.childErrors};