react-final-form
react-final-form copied to clipboard
Fields remove not working with foreach array
Are you submitting a bug report or a feature request?
bug report
What is the current behavior?
I had an array, which is an collection of id for removing from fields. After fields.remove(index), the fields.value does not update immediately, causing next fields.remove(index) error.
What is the expected behavior?
Remove all the field in the array.
Sandbox Link
https://codesandbox.io/s/react-final-form-field-arrays-forked-l2ccvo
Please click the server remove button to test.
What's your environment?
OS: macOS Browser: Chrome "node": "14.19.0" "react-final-form": "^6.5.9", "react-final-form-arrays": "^3.1.3",
I changed to use removeBatch mutators. It also go wrong. https://codesandbox.io/s/react-final-form-field-arrays-forked-lhsx2n?file=/index.js
With newest versions removeBatch is working fine. https://codesandbox.io/s/react-final-form-field-arrays-forked-oe87sp