final-form / react-final-form-arrays

A component for rendering and editing arrays 🏁 React Final Form
MIT License
204 stars 69 forks source link

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

Open rrjohnson85 opened 6 years ago

rrjohnson85 commented 6 years ago

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?

Other information

N/A

tatchi commented 6 years ago

Hello,

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

311chaos commented 6 years ago

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 commented 6 years ago

this should be resolved in final-form-arrays@1.1.0

rrjohnson85 commented 6 years ago

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

erikras commented 6 years ago

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

dima19972525 commented 5 years ago

Have similar problem