Replies: 5 comments 2 replies
-
we don't support |
Beta Was this translation helpful? Give feedback.
-
@bluebill1049 Would be useful if there was a way to reset form state completely. Also I think |
Beta Was this translation helpful? Give feedback.
-
Is there some decision? |
Beta Was this translation helpful? Give feedback.
-
If you are not planning to support |
Beta Was this translation helpful? Give feedback.
-
Can you describe why undefined values are not supported? |
Beta Was this translation helpful? Give feedback.
-
Version Number
7.51.2
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/react-hook-form-reset-undefined-w3p8ks
Steps to reproduce
Initialize the form with some
values
ordefaultValues
:Assume that the data was re-fetched from server and the form needs to be reset to reflect the actual state (in this scenario the profile image was removed on another device):
Result: the image value wasn't reset.
Additional info: it used to work fine in version 7.21.0
Workaround 1: replace all undefined values with null when calling reset:
Workaround 2: call
reset
with and without arguments multiple times (you can try to press buttons in the pvovided codesandbox a few times, eventually it will reset lastname), this behaviour is inconsistent.Discussion
Expected behaviour
It should reset the form state completely to match the provided object without “merging” it with the previous values.
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions