-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Description
Describe the bug and the expected behavior
Here is the problem:
fields.subFields.required→booleanfields.subFields.subSubFields.required→undefined(❌ should beboolean)
Environment:
- React Router 7
- Zod 4
- Conform 1.8.2
Conform version
v1.8.2
Steps to Reproduce the Bug or Issue
Create a Zod 4 Schema with 2 levels of depth:
const Schema = z.object({
isRequired: z.string(),
items: z.array(
z.object({
isRequired: z.string(),
subItems: z.array(
z.object({
shouldBeRequired: z.string(),
}),
),
}),
),
});Then, you will see:
const [form, fields] = useForm({
id: "my-form",
constraint: getZodConstraint(Schema),
onValidate({ formData }) {
return parseWithZod(formData, {
schema: Schema,
formatError: (issues: z.core.$ZodIssue[]) => formatError(t, issues),
});
},
defaultValues: {
isRequired: "",
items: [
{
isRequired: "",
subItems: [
{
shouldBeRequired: "",
},
],
},
],
},
shouldValidate: 'onBlur',
shouldRevalidate: 'onInput',
});
console.log({
isRequired: fields.isRequired.required, // true
items: {
isRequired: fields.items.getFieldList()[0]?.getFieldset().isRequired.required, // true
subItems: {
shouldBeRequired: fields.items.getFieldList()[0]?.getFieldset().subItems.getFieldList()[0]?.getFieldset().shouldBeRequired, // undefined
},
}
});What browsers are you seeing the problem on?
Chrome
Screenshots or Videos
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels