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

reset({}, { keepDefaultValues: true }) with useController clears out input's value but keeps form value #5687

Closed
JGibel opened this issue Jun 18, 2021 · 1 comment · Fixed by #5688
Labels
bug Something isn't working

Comments

@JGibel
Copy link

JGibel commented Jun 18, 2021

Describe the bug
calling reset with keepDefaultValues clears default values (with useController).

To Reproduce
Steps to reproduce the behavior:

  1. Create form with an input created with useController. Default value can be provided on the useForm level or inline.
  2. Call reset({}, { keepDefaultValues: true })
  3. The value passed to the input gets set to undefined. a watch on the field value does not change.

Codesandbox link (Required)
Include a codesandbox will help us to investigate the issue quicker.

V7

  • JS CSB
    You can reproduce in this sandbox by hitting the reset button. The value updated log statement shows the value passed to the input ref, the field updated statement shows the form's value.

Expected behavior
input value and form value should match. This does not impact the value passed to submit. Just keeps showing the annoying react error warning message.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):
Don't think it matters, but here's mine:

  • OS: [macOS (Big Sur)]
  • Browser [Chrome]
  • Version [Version 91.0.4472.106 (Official Build) (x86_64)]
    Additional context
    Not a real issue as far as I can tell, but those react error messages are polluting my logs and make it difficult to debug.
@bluebill1049 bluebill1049 added status: under investigation aware of this issue and pending for investigation bug Something isn't working and removed status: under investigation aware of this issue and pending for investigation labels Jun 18, 2021
@bluebill1049
Copy link
Member

Fixed, thanks.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants