react-hook-form: Problems with custom array & yup
Describe the bug
While trying to reproduce what we have in our codebase (where yup.array(yup.string().oneOf([...])) doesn’t seem to set errors object) I ran into what seems to be a different issue.
Seems like when arrays have a strict validator (example yup.array(yup.number())) and we try to set it to something, that doesn’t validate (example a string '123') the setValue throws error TypeError: error.inner is undefined.
Crashing in Firefox seems to be a problem of yup (jquense/yup#683)
To Reproduce
Navigate to codesandbox
In there if you try to click the first “checkbox” with text test - it gets set correctly and -Checked show up next to it.
If you try to check any other, which shouldn’t pass validation, nothing happens and there is an error thrown in console.
Codesandbox link Codesandbox
Expected behavior
I expect the errors object to be updated when I select any checkbox other than the first one.
Desktop (please complete the following information):
- Device: Thinkpad, Macbook Pro
- OS: Linux, MacOS
- Browser Firefox, Chrome
- Version 3.27.0-beta.1, 3.26.5
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (12 by maintainers)
No problem, I quickly grew to love this project when replacing our Formik based form, mainly because the implementation was so smooth and clean. Keep up the great work and thanks for the quick response time! I’ll try and help on the
yupside so this can be closed soon.no worries @tomaskallup thanks for reporting the issue and help on testing too 👍
@bluebill1049 Perfect, thank you! I’ll keep an eye on that PR waiting for release.