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

OnChange leads to "ghost data" appearing in field #25

Open
abrad45 opened this issue Aug 27, 2020 · 0 comments
Open

OnChange leads to "ghost data" appearing in field #25

abrad45 opened this issue Aug 27, 2020 · 0 comments

Comments

@abrad45
Copy link

abrad45 commented Aug 27, 2020

Are you submitting a bug report or a feature request?

Bug Report

What is the current behavior?

I have a field, a. Depending on the value of a, another field, b, appears. Additionally, when changing a, we need to change the value of b as well (either setting it or clearing it out). It's possible to get the value of b to read one thing, even though its value in the form state is something else. When you focus field b it snaps to that other value, seemingly indicating that it didn't rerender after its value changed (?)

CleanShot 2020-08-27 at 17 19 57

What is the expected behavior?

<OnChange /> should work the same as the useEffect hook I commented out in the file. if you use that instead of <OnChange />, it works as I'd expect: the data in the form values should match the data reflected in the form field itself.

Sandbox Link

https://codesandbox.io/s/ecstatic-kare-2jcts?file=/target.js

What's your environment?

See sandbox: newest everything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant