-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue: onChange validation of arrays with a single value not rendering #10744
Comments
It seems this issue was introduced on |
The root cause is the checking field value with In case field value is an array with only 1 item, for example, react-hook-form/src/logic/createFormControl.ts Lines 749 to 751 in 109a12e
May be a simple check |
thanks @leapful let's add the check 🙏 would you mind to send a PR on this? |
If the |
This comment was marked as abuse.
This comment was marked as abuse.
=> For checking updated value on array, it would be safer to use
=> Please open an new issue or discussion with a minimal re-producible codesandbox url if you find out something that could be a bug. It would help to avoid confusion on this current issue.
=> E2E tests are already implemented in here https://github.com/react-hook-form/react-hook-form/tree/master/cypress. Feel free to submit a PR with your test cases. Open source libraries always needs contribution from the community to make it better since no one can cover all test cases from real world. |
@leapful I'm in the process of creating a PR, but I'm not being able to reproduce the issue in a test in |
thanks for looking into this @eg-bernardo 🙏 |
I cannot reproduce it because this issue has been fixed by 3ca1701 I'll create a PR with the test to avoid future regressions. |
thanks @eg-bernardo i will try to release the patch this week. |
Co-authored-by: Bernardo <bernardo@externalia.local>
Version Number
7.45.1
Codesandbox/Expo snack
https://codesandbox.io/s/array-validation-issue-repro-hqn27r
Steps to reproduce
Expected behaviour
ok
error, required error stays
error, required error stays even though validate get's called
now form does update
What browsers are you seeing the problem on?
Firefox, Chrome
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: