Open mrassili opened 3 years ago
@erikras do you have any clue on this please?
@mrassili this may be because of how validation works on Fields in final-form. By default when a field changes it triggers validation on all fields in the form. I'm guessing that could cause a cascade here until update-depth is exceeded.
Fields have a prop called validateFields which is a string array of names of other fields that should be validated when this one validates. If you set this field to an empty array then no other fields will be validated when this one changes. (See: FieldProps). If you set validateFields={[]}
on the nested Field does it prevent the exception?
@tjb042 No it does not. I tried setting validateFields
on both nested and parent fields, it didn't work.
I ended up making the fields siblings to avoid this exception
Are you submitting a bug report or a feature request?
could be a bug
What is the current behavior?
I have a nested field that when I attach a validator gives this React error with this stack trace If I remove the validators from the nested fields it works
The code basically looks like this:
Maybe someone can spot the culprit here
What is the expected behavior?
a nested field shouldn't cause infinite loop
Sandbox Link
What's your environment?
React Final Form v6.5.1 Final Form v4.20.0 Chrome Node v12.14.0
Other information
Similar issue #408 #625