react-hook-form / documentation

📋 Official documentation
http://react-hook-form.com
MIT License
723 stars 1.03k forks source link

issue: In the specified sandbox environment, when the onChange event handler is invoked with undefined as its argument, the Component does not receive the updated value. However, despite this, the form data is successfully updated. #1042

Closed manishjatiwal closed 8 months ago

manishjatiwal commented 8 months ago

Version Number

7.49.3

Codesandbox/Expo snack

https://codesandbox.io/p/sandbox/rhf-bug-mfygck?file=%2Fsrc%2FApp.js

Steps to reproduce

Just open the sandbox, and click on the buttons. The first component uses undefined as the argument to onChange, and hence is not working as expected. The second component used empty string as as the argument to onChange, and works beautifully.

Expected behaviour

After setting the value as undefined by calling the onChange(undefined), ComponentOne should get the update value i.e, undefined, instead of default value.

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

Code of Conduct

bluebill1049 commented 8 months ago

can you share the link for the page? and which codesandbox

manishjatiwal commented 8 months ago

https://codesandbox.io/p/sandbox/rhf-bug-mfygck?file=%2Fsrc%2FApp.js

bluebill1049 commented 8 months ago

yes that's the one you forked, i want to know the original

manishjatiwal commented 8 months ago

@bluebill1049 Why close this? I am uncertain about your request. The issue in question can be readily replicated using the provided code sandbox.