react-hook-form: issue: Validation on nested fieldArrays is not consistent
Version Number
7.20.2
Codesandbox/Expo snack
https://codesandbox.io/s/suspicious-kirch-v2dy3?file=/src/schemas.js
Steps to reproduce
- Open the provided codesandbox
- Turn on the switch on the right side. A
TextFieldwith the value “Ace” will be generated. Remove one character and you will see an error. - In the opened
schemas.jsfile, scroll down until you find commented out code. Comment it back in. - Turn off the switch on the right side and try to reproduce step 2.
Triggering the error manually on every input change as you can find commented out in the NameList component doesn’t seem to have any effect, which is also very peculiar.
Expected behaviour
The validation process should register the error in the formState object. From what I know, the useFieldArray methods don’t trigger validation. Which is considered. Using trigger doesn’t seem to have an effect either.
I’m wondering if there is something that I’m not considering or doing wrong. But after fighting for hours with this I’m here…
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
- I agree to follow this project’s Code of Conduct
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (8 by maintainers)
Ehm, did you even read what I wrote or look into the provided example? I am mentioning that trigger apparently doesn’t work.
react hook form is focused on field-level validation, for parent node level validation with the schema you will have to use
trigger.