final-form / final-form/react-final-form-arrays
Indexes as keys break components behaviour
- Dominant language
- TypeScript
- Stars
- 210
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
### Are you submitting a **bug report** or a **feature request**?
a **bug report**
### What is the current behavior?
If i have an array of two fields, and remove index 0, then component at index 0 is updated with value of component at index 1 and component at index 1 is deleted.
### What is the expected behavior?
If i have an array of two fields, and remove index 0, then component at index 0 is deleted.
Exemple
### Sandbox Link
Any example of this lib has this issue
https://codesandbox.io/s/kx8qv67nk5
### What's your environment?
### Other information
Clearly the problem here is that indexes are used as keys.
Maybe final-form-array could create unique keys at push and keep track of them during other operations and provide this key in FieldArrayRenderProps.
We could not rely either on value ref for maintaining the index => key mapping.
Contributor guide
Assessment
This issue has not been assessed yet.