react-hook-form: issue: Uncontrolled inputs: Memoized component inputs not updating through Reset(reset from useForm)
Version Number
7.24.2
Codesandbox/Expo snack
https://codesandbox.io/s/provider-perf-forked-6lyw9?file=/src/App.js
Steps to reproduce
I actually forked https://react-hook-form.com/advanced-usage#FormProviderPerformance, with a few modifications.
- Make sure the codesandbox virtual browser is refreshed
 - Click on “reset” button
 - input registered as “immediateInput” is successfully reset
 - input registered as “test”(memoized input component) is on default state
 
Expected behaviour
- 
“Test” input(memoized) should update after the reset.

 - 
Notice if we set
shouldUnregistertotruethen click reset, it will show “Test” input is not registered anymore.
 - 
Other things to note, after clicking “reset” button, when editing the “immediateInput” input field through typing, it will now show the updated value of “test” input. Even if we set
shouldUnregistertotrue, “test” input will still update as long as we type on “immediateInput” input, but nothing will happen if we edit first the “test” input field after clicking “reset” button. 
I was stuck with this issue for a few days now, tried reading the docs related to the issue several times, I still can’t find an answer, that’s why I decided to post an issue. I might be missing something.
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
- I agree to follow this project’s Code of Conduct
 
About this issue
- Original URL
 - State: closed
 - Created 2 years ago
 - Comments: 17 (8 by maintainers)
 
Use
prevProps.formState.isDirty && nextProps.formState.isDirtyinstead ofprevProps.formState.isDirty === nextProps.formState.isDirtyas what @bluebill1049 have said
ok here is the reason behind this issue.
Here are the steps:
resetall input references and form values will be removedSolutions
reset, so the reference will still be retained.Thanks @bluebill1049 , yodabest.