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

FieldArray's unshift mutator does not update state correctly #36

Open
rrjohnson85 opened this issue Jul 25, 2018 · 6 comments
Open

FieldArray's unshift mutator does not update state correctly #36

rrjohnson85 opened this issue Jul 25, 2018 · 6 comments

Comments

@rrjohnson85
Copy link

Are you submitting a bug report or a feature request?

Bug

What is the current behavior?

When using the unshift mutator to add an item to the beginning of an array, the touched state from the item previously at index zero (if one exists) is maintained.

What is the expected behavior?

I would expect the item that was added to the beginning of the array to have a touched state of false.

Sandbox Link

N/A, but I will happily provide one if needed.

What's your environment?

  • final-form: 4.8.3
  • react-final-form: 3.6.4
  • final-forms-array: 1.0.4
  • react-final-forms-array: 1.0.6
  • React: 16.4.1
  • Chrome: 68.0.3440.75

Other information

N/A

@tatchi
Copy link

tatchi commented Aug 9, 2018

Hello,

If it can help for further investigation, I think it might be related to #33

@311chaos
Copy link

I have a similar issue. I am noticing that the meta associated with a field is not moved with the input values. So, when you move things around with mutators, the input is moved, but is then associated with the meta from whatever previously existed at the new index.

This is particular problematic with Drag-and-drop. My field moves, but the meta, which includes things like dirty, pristine, touched, valid, etc, all stay associated with the wrong input values.

@311chaos
Copy link

this should be resolved in [email protected]

@rrjohnson85
Copy link
Author

@311chaos sweet, I'll try it out and report back.

@erikras
Copy link
Member

erikras commented Aug 23, 2018

No. This is not resolved. In fact, my [email protected] fix mistakenly assumed that that sort of movement was the only problem, but unshift is a different beast. ⚠️ Still in progress.... ⚠️

@dima19972525
Copy link

Have similar problem

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

5 participants