Skip to content

Commit 423b8a7

Browse files
Update packages/@core/ui-kit/form-ui/src/use-form-context.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent e222e65 commit 423b8a7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/@core/ui-kit/form-ui/src/use-form-context.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,8 @@ export function useFormInitial(
5151
} else if (item.rules && !isString(item.rules)) {
5252
// 检查规则是否适合提取默认值
5353
const customDefaultValue = getCustomDefaultValue(item.rules);
54-
if (customDefaultValue === undefined) {
55-
// 否则将规则添加到 zodObject
56-
zodObject[item.fieldName] = item.rules;
57-
} else {
58-
// 如果有自定义默认值,直接使用
54+
zodObject[item.fieldName] = item.rules;
55+
if (customDefaultValue !== undefined) {
5956
initialValues[item.fieldName] = customDefaultValue;
6057
}
6158
}

0 commit comments

Comments
 (0)