-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
move
and swap
only affect values, not field state
#10
Comments
I have a similar issue. @dallonf - Did you come up with a work-around of any sorts? There is also a similar discussion over on the react-final-form-arrays repo. final-form/react-final-form-arrays#36 @erikras - I am not sure how to track this down through all the repos. I have followed it from react-final-form-arrays to final-form-arrays to Is there any way to have the meta move with the input? |
Great reporting, @dallonf. |
I have confirmed this is a bug and have made some progress on it, but not yet conquered it. Stay tuned. |
Thanks for the update @erikras. I really appreciate your time. |
Published fix in Sandbox with updated dep: |
During move and swap, the field state of the source field was copied to the target field. The field state, however, contained functions that had a reference to the previous position. This caused changes to be applied to the wrong field. Resolves: final-form#15 See also: final-form#10
Published fix in |
Are you submitting a bug report or a feature request?
I believe this is a bug.
What is the current behavior?
Here is a version of of the React Final Form Arrays example, modified to have validation errors that only appear when a field has been touched:
https://codesandbox.io/s/8k623wrrz9
The names have changed, but the "Required" error message is still in the same place (or, depending on your perspective, has moved to a different customer).
What is the expected behavior?
I would expect the "touched" state to move along with the field, so that in this example the error would still be attached to Homer's last name, even though Homer has moved.
What's your environment?
Other information
The demo shows this happening with
swap
, but I originally observed the behavior withmove
.The text was updated successfully, but these errors were encountered: