mirror of
https://github.com/langgenius/dify.git
synced 2026-04-27 14:08:18 +08:00
fix: ensure default values are handled correctly in InputNumber and related components
This commit is contained in:
@ -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)}>
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user