Open IzaGz opened 4 years ago
Same thing is happening for me
The underlying state is properly getting updated but the rendered react components become stale. It looks like a problem with this library's intended usage of wrapping each item field with:
<div key={name}>
When there is an array named foo
and it has two items, the names of those items are foo[0]
and foo[1]
. When foo[0]
is deleted, foo[1]
takes it's place and is rendered as foo[0]
, which either React or Final Form sees as the original `foo[0] and assumes it hasn't changed.
In my case the issue was fixed by generating unique temporary keys for each item and wrapping each field with:
<div key={fields.value[i].key}>
Thanks, @silentorb this worked for me. Wish this could be fixed by default.
BUG
just use this and every time last item removd, how ti fix this?