Bug Fix: Add state.change to useField's onChange dependencies. #477
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First off, I love the project and appreciate being able to use it.
In my project I have what may be an unconventional form where the fields that are rendered on the screen depend on what the user selects. The form as well as all the selectable categories are visible at the same time. I found a problem when I was migrating to version 5.x in my unit tests where once a subset was 'selected' a second time a textarea onChange event no longer updated the fields value.
I was trying to debug my own code and found no problems so I started playing with the code under the hood and I found that
state.change
was not part of the dependencies of the onChange useCallback. I added it and my test started passing as expected.Adding state.change as a dependency is all the pull request does, but if there is a reason that state.change should not be in the dependencies (maybe performance?) then I could work on creating a reproducible example.