Correct behaviour for apps using react-compiler
Is your feature request related to a problem? Please describe.
Experimenting with react-compiler, the only failing tests in our suite seem to be due to using parts of react-hook-form which break the "rules of react" (eg: hook return values are immutable) (ie: not limited to watch)
I've added react-compiler to the react-hook-form unit test code here and see
Test Suites: 15 failed, 81 passed, 96 total
Tests: 35 failed, 836 passed, 871 totalDescribe the solution you'd like
The library should be consistent and performant whether the user is compiling or not.
I think this can be achieved by adhering to the rules. eg: this change fixes src/__tests__/useFormContext.test.tsx (but there may be consequences or cases I'm not aware of.)
Happy to contribute but will need guidance from maintainers.
Thanks!
Source: react-hook-form/react-hook-form