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
I've updated the codesandbox demo and it's working a lot better, but I'm still having an issue or two.
If you open it again and remove the LAST row from the form, it shows the form is not valid and therefore can't be submitted. Removing any other row seems to be fine.
This issue is caused by the field value changing momentarily to be undefined since it no longer exists in the array, that is when a validation run is executed against that field before it is removed. However since the removal part is done synchronously the field is removed before the validation is concluded which then sets the errors for that non-existent field.
We either need to skip the validation run altogether or make sure it is ignored.
The text was updated successfully, but these errors were encountered:
logaretm
changed the title
Thank you @logaretm, that gets me further! I've updated the [codesandbox demo](https://codesandbox.io/s/delicate-microservice-366jye) and it's working a lot better, but I'm still having an issue or two.
[v4] Removing last item in array field doesn't clean up its errors
Apr 10, 2022
What
Originally posted by @danh65 in #3732 (reply in thread)
Why
This issue is caused by the field value changing momentarily to be
undefined
since it no longer exists in the array, that is when a validation run is executed against that field before it is removed. However since the removal part is done synchronously the field is removed before the validation is concluded which then sets the errors for that non-existent field.We either need to skip the validation run altogether or make sure it is ignored.
The text was updated successfully, but these errors were encountered: