You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removes the values at the specified indexes of the field array.
What is the expected behavior?
The documentation above didn't prepare me for the fact that, if there's only one value left in the field array, the result won't be an empty array. If the last element is removed from the array, the whole array gets removed and the field is set to undefined.
Are you submitting a bug report or a feature request?
Documentation update request - I'm not sure if that counts as a bug or a feature.
What is the current behavior?
The current documentation for
remove
andremoveBatch
methods:Removes a value from the specified index of the field array. Returns the removed value.
Removes the values at the specified indexes of the field array.
What is the expected behavior?
The documentation above didn't prepare me for the fact that, if there's only one value left in the field array, the result won't be an empty array. If the last element is removed from the array, the whole array gets removed and the field is set to
undefined
.Sandbox Link
What's your environment?
Other information
Code that sets the array to
undefined
if its length is zero: https://github.com/final-form/final-form-arrays/blob/fe3c260939cbdd446a48304dd2df0be2a1c41237/src/remove.js#L20C5-L22C18The text was updated successfully, but these errors were encountered: