From 8a364f67eb6914947b9623170bcc4bc3f366010d Mon Sep 17 00:00:00 2001 From: Denis Ryabko Date: Fri, 10 Oct 2025 12:08:43 +0300 Subject: [PATCH 1/3] fix(utils): improve handling of default values and number conversion in form controller utils --- src/lib/core/components/Form/Controller/utils.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/core/components/Form/Controller/utils.tsx b/src/lib/core/components/Form/Controller/utils.tsx index f2415c8b..b80ad2f5 100644 --- a/src/lib/core/components/Form/Controller/utils.tsx +++ b/src/lib/core/components/Form/Controller/utils.tsx @@ -239,7 +239,7 @@ export const getFieldInitials = < } if (isNil(value)) { - if (spec.defaultValue) { + if (!isNil(spec.defaultValue) || spec.defaultValue !== '') { value = transformArrIn(spec.defaultValue) as DirtyValue; } // if the spec with type array or object, and this spec has "required === true", @@ -298,7 +298,7 @@ export const getFieldMethods = < let value = transformArrIn(_value); if (isNumberSpec(spec) && !error) { - value = (value ? Number(value) : undefined) as DirtyValue; + value = (isNil(value) || value === '' ? undefined : Number(value)) as DirtyValue; } let newChildErrors: Record = {...state.childErrors}; From e483bd3cffd79daca86b80a2d144e9215daf6cee Mon Sep 17 00:00:00 2001 From: Denis Ryabko Date: Fri, 10 Oct 2025 12:24:12 +0300 Subject: [PATCH 2/3] fix(utils): refine default value checks in getFieldInitials function --- src/lib/core/components/Form/Controller/utils.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/core/components/Form/Controller/utils.tsx b/src/lib/core/components/Form/Controller/utils.tsx index b80ad2f5..3ef6459d 100644 --- a/src/lib/core/components/Form/Controller/utils.tsx +++ b/src/lib/core/components/Form/Controller/utils.tsx @@ -239,7 +239,7 @@ export const getFieldInitials = < } if (isNil(value)) { - if (!isNil(spec.defaultValue) || spec.defaultValue !== '') { + if (!(isNil(spec.defaultValue) || spec.defaultValue === '')) { value = transformArrIn(spec.defaultValue) as DirtyValue; } // if the spec with type array or object, and this spec has "required === true", From fdfcad982fc6b8bb8c904c4cd079f1dcf68931a6 Mon Sep 17 00:00:00 2001 From: Denis Ryabko Date: Thu, 23 Oct 2025 14:10:39 +0300 Subject: [PATCH 3/3] fix(utils): simplify default value condition in getFieldInitials function --- src/lib/core/components/Form/Controller/utils.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/core/components/Form/Controller/utils.tsx b/src/lib/core/components/Form/Controller/utils.tsx index 3ef6459d..94f8c708 100644 --- a/src/lib/core/components/Form/Controller/utils.tsx +++ b/src/lib/core/components/Form/Controller/utils.tsx @@ -239,7 +239,7 @@ export const getFieldInitials = < } if (isNil(value)) { - if (!(isNil(spec.defaultValue) || spec.defaultValue === '')) { + if (!isNil(spec.defaultValue)) { value = transformArrIn(spec.defaultValue) as DirtyValue; } // if the spec with type array or object, and this spec has "required === true",