This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
RHF is triggering 3 times as many rerenders on validation #11769
Labels
question
Further information is requested
Version Number
7.51.1 and 7.51.2 (latest)
Codesandbox/Expo snack
This link
Steps to reproduce
First of all, thank you very much for this library. It has been my go-to for a long time now!
Reproduction
If I downgrade the react-hook-form version from 7.51.1 to 7.51.0, then you will only see 2 entries in the Console. This means there is some kind of regression. I spent quite a bit digging but I'm not sure what's causing it yet. I noticed the release notes of 7.51.1 mentioned validatingFields. That seems to be related.
I commented out some other components that I was testing with, but they don't seem to be affected (there seems to be no difference between the old and newer versions of react-hook-form, with relation to rerenders).
Also, if you fill in the complete form correctly, and then submit, you will see 4 entries before the
onSubmit
console.log(data)
call, and 4 entries after it, whereas with 7.51.0 you'll only see theonSubmit
console.log(data)
, and then 4 entries after it.Repo for testing
If you want to quickly play around with this, here's a repo I set up with create-next-app: https://github.com/voinik/rhf-rerender-issue
Expected behaviour
I expect no extra rerenders compared to 7.51.0.
What browsers are you seeing the problem on?
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: