Closed jrcastro2 closed 2 years ago
I think I will need a call to understand how this works :)
I can try to explain it here so everyone can check it but feel free to reach out if not clear enough.
We also need to check for the initialErrors
mainly because we have added the formik option enableReinitialize
that apparently resets the form when the props change (when submitting as example). Meaning that every time the props change the form resets and the Errors
prop is cleared. In order to still keep the errors we store them in InitialErrrors
(see "workaround" here). So when we display the errors, first we need to check for the Errors
prop of Formik and if empty we also need to check for the InitialErrrors
prop as the errors might be cleared due to enableReinitialize
.