fix: ensure default values are handled correctly in InputNumber and related components

This commit is contained in:
twwu
2025-07-17 18:15:52 +08:00
parent 3388e83920
commit 59f68cd63b
5 changed files with 12 additions and 12 deletions

View File

@ -18,7 +18,7 @@ const NumberInputField = ({
className,
...inputProps
}: TextFieldProps) => {
const field = useFieldContext<number | undefined>()
const field = useFieldContext<number>()
return (
<div className={cn('flex flex-col gap-y-0.5', className)}>

View File

@ -47,7 +47,7 @@ export const generateZodSchema = (fields: BaseConfiguration[]) => {
zodType = (zodType as ZodString).nonempty(`${field.label} is required`)
}
else {
zodType = zodType.optional()
zodType = zodType.optional().nullable()
}
shape[field.variable] = zodType