question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Controller value reset after remove

See original GitHub issue

Describe the bug Modified value of Controller in list (useFieldArray) is not preserved after calling remove, when the component use a complex value, like objects

To Reproduce Steps to reproduce the behavior:

  1. Go to codesandbox
  2. Click on append
  3. select an value in the select input, and an date in the date picker
  4. click on remove in the first value of the useFieldArray
  5. the values are gone
  6. see in the console that the component received another value( empty string or undefined)

Codesandbox link codesandbox

Expected behavior don’t lose values of the component

Obs: yes, this issue is similar to the issue #1172, but i am having this problem before, and this commit https://github.com/react-hook-form/react-hook-form/commit/1bfb7c10d6f09fc188c978eb4e9629af00d7b084 dont solved the problem

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:20 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
vensaurocommented, Mar 9, 2020

Okay, i see that the CSB that i picked by template, use the name test in the useFieldArray, and when change this the date field works 👍

0reactions
bluebill1049commented, Mar 9, 2020

🙏 you can submit a PR at our website repo! ❤️ if the doc is not having the correct example, feel free to update it and get your name on the contribution list 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

flutter - How do I reset my controller when I come back or finish?
You can use Get.reset() if you only have one controller. It clears all registered instances.
Read more >
useForm - reset - React Hook Form
An optional object to reset form values, and it's recommended to provide the entire defaultValues when supplied. keepErrors, boolean. All errors will remain....
Read more >
React Hook Form - Reset form with default values and clear ...
This is a quick example of how to reset a React Hook Form with default values and clear form validation error messages.
Read more >
How to Reset the Integrated Dell Remote Access Controller ...
To reset the iDRAC to factory default values using the iDRAC Settings Utility. ... The system restarts after all iDRAC setting are set...
Read more >
Fisher™ FIELDVUE™ DVC6200 Digital Valve Controller
D Restart Control Mode—This defines the Control Mode of the instrument after a restart (e.g. power cycle). Available choices are Resume Last, Analog...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found