Describe the bug
In version 6.11.3 and before, the formState.isValid was true when the forms defaultValues are valid but not rendered in the DOM.
In version 6.11.4 and after, the formState.isValid is initially set to true, but is immediately set to false after the resolver has run, even if the defaultValues are valid.
Steps to reproduce the behavior:
- Go to https://codesandbox.io/s/rhf-incorrect-isvalid-wluyk?file=/src/App.tsx
- Open console and see that: isValid is initially true, but later set to false after resolver has been run.
- Click “Toggle form” and see that the Confirm button is disabled (and the isValid flag continues to be false)
Codesandbox link (Required)
I expect the isValid flag to be true when clicking “Toggle form” to display the form.
Expected behavior can be reproduced by opening the above codesandbox (https://codesandbox.io/s/rhf-incorrect-isvalid-wluyk?file=/src/App.tsx) and changing the react-hook-form version to 6.11.3
Desktop (please complete the following information):
- OS: MacOS 10.15.7
- Browser Chrome 88.0.4324.146
- Version 6.11.4 and later