-
Hey, I'm using react-hook-form with material ui components via useController. I'm attempting to reset a form with new values while keeping the defaultValues unchanged. I see with getValues that immediately after calling Am I misunderstanding the use for reset or is there some error in my logic? I wouldn't want to use setValue as I'll need to update many fields at the same time. Here's a codesandbox link demonstrating the issue: https://codesandbox.io/s/upbeat-robinson-zph9n By looking at console logs we can see that after pressing 'Load values' the form values are changed. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Seems like Here's a simplified CSB that shows the issue: https://codesandbox.io/s/nameless-monad-fvkt2 If you go back to e.g. version 7.8.8 the reset will actually change the input values. |
Beta Was this translation helpful? Give feedback.
-
can confirm this doesn't work as you'd expect. |
Beta Was this translation helpful? Give feedback.
Seems like
reset(values, { keepDefaultValues: true }
works in my example in versions before 7.9.0.Here's a simplified CSB that shows the issue: https://codesandbox.io/s/nameless-monad-fvkt2
If you go back to e.g. version 7.8.8 the reset will actually change the input values.