formik
formik copied to clipboard
Trigger validation on Pop of array-of-objects
Make a copy of the original array, so that validation happens the same as when calling Remove on the last element.
Test case: https://codesandbox.io/s/formik-fieldarray-change-validation-bug-forked-fddidy?file=/index.js note that after adding an element, clicking on "pop" doesn't clear the error, whereas clicking on its "x" button does.
This issue affects arrays of objects in the schema. Returning a copy of the old array, instead of the original, means that validation is triggered and the errors object is correctly updated.
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.
formik-docs – ./
🔍 Inspect: https://vercel.com/jared/formik-docs/A6K2Viw2kDZKeQCF4MV7maCgoR9P
✅ Preview: Failed
Fixed in recent releases