-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Stale useWatch value #2738
Comments
Thanks for the issue report, look like this is expected behavior rather than a bug. as for now, we are getting https://github.com/react-hook-form/react-hook-form/blob/master/src/useWatch.ts#L62 If this is your requirement, I would recommend to have useWatch on and remove the toggle. feel free to submit a feature request regarding this problem, I will tag with for waiting for upvotes, then work on depending on the demand from the community. |
Alright then, I will go with a feature request. Thanks! |
Thanks @cYee992 👍 |
@bluebill1049 I have given it some thought about it. I am not so sure am I using useWatch right. Let's say the user key in a form with quatity and price, they can click on the button to show a 'total price' modal, before submit. without the latest value it will be the generated based on initial default values which is always wrong. Or am I using it wrong? is that it should be the usecase of watch() since it will unmount eventually? |
@cYee992 if you keep |
Alright~ For sure! Thanks for the swift reply! |
Describe the bug
useWatch returning stale value(default value) instead of latest value (Latest version of react-hook-form)
To Reproduce
Steps to reproduce the behavior:
Codesandbox link (Required)
https://codesandbox.io/s/react-hook-form-wizard-form-forked-f4wmt?file=/src/index.js
Expected behavior
The value should have updated, but this on works if watch display is on all the time.
The text was updated successfully, but these errors were encountered: