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: dirtyFields is incorrect when reset() with keepDefaultValues
and keepDirtyValues
#11386
Comments
I updated the reproduction to the vite-based one. It might be a good idea to update the link in the issue template if possible. The existing one links to a CSB with a pretty old version of react-hook-form, using an old create-react-app. |
|
Thanks for trying to fix with a PR @IanVS 🙏 I will take a look at it today. |
Strange, I guess CSB doesn't automatically update if you sync with a repo? Sorry about that. I can't figure out how CSB is working, so here's the link to my repository instead: https://github.com/IanVS/reproduction-keep-dirty-and-default I think I can make a PR after all, though I'm not sure if it's the right approach. I'll do that now. |
…defaults and dirty values (react-hook-form#11401) * Add test * Get newly-dirty fields when keeping defaults and dirty values
Version Number
7.49.3
Codesandbox/Expo snack
https://codesandbox.io/p/github/IanVS/reproduction-keep-dirty-and-default/main
Steps to reproduce
Expected behaviour
Sorry, I've got another sneaky potential
keepDefaultValues
bug.I think I should be able to update the value of non-dirty fields in the form without changing the defaultValue, and dirty tracking should continue to work correctly.
I did notice that controlled form elements work correctly as I expect, but not uncontrolled as shown in the reproduction.
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: