Skip to content
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

useWatch rules update: initial value #952

Open
SteffeyDev opened this issue May 8, 2023 · 1 comment
Open

useWatch rules update: initial value #952

SteffeyDev opened this issue May 8, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@SteffeyDev
Copy link

The useWatch docs currently state that "The initial return value from useWatch will always return what's inside of defaultValue or defaultValues from useForm."

I noticed in my own testing (codepen) that this doesn't seem to be the case, and useWatch seems to return the current form value on mount instead of the default values. This PR (which added this feature) and an inspection of the current code seem to confirm that the current form values are used on initial load if available, and only fall back on the default values if it has to (not sure what that case is when _state.mount is false).

Am I implementing useWatch in a non-standard or unusual way, or are the docs out of date here, or perhaps the way it is worded is confusing me?

@bluebill1049
Copy link
Member

seems to return the current form value on mount instead of the default values.

you are right, would you like to improve the doc on that part?

@bluebill1049 bluebill1049 added the enhancement New feature or request label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants