-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resetForm handler doesn't work same at formik 2 version #2034
Labels
Comments
I'm having the same issue, any news about this? |
Hi @jaredpalmer, can you see this, please? 🙏 |
I'm trying to upgrade to formik v2.0 and I'm having the same error. I think until this is sorted out I have to revert back to v1 for now |
Can you submit a PR? |
should close since PR merged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 Bug report
With formik 1, when we use resetForm handler and we don't pass nextValues, it uses initialValues from props. You can see this behavior in https://github.com/jaredpalmer/formik/blob/version-1.5.8/src/Formik.tsx#L532
But, with formik 2, when we use resetForm handler and we don't pass nextValues, it uses initialValues from a ref and this ref is only updated when the initialValues changes and the variable enableReinitialize is true. You can see this behavior in https://github.com/jaredpalmer/formik/blob/master/src/Formik.tsx#L362
Current Behavior
resetForm handler uses initialValues from ref using formik 2.
Expected behavior
Use initialValues from props when we use resetForm handler, same as formik 1.
Suggested solution(s)
I don't know if this is an issue or the correct behavior. I need to know if the formik 1 resetForm behavior is the correct (And fix it in formik 2) or the actual behavior is correct and it's a bug with formik 1.
Additional context
Your environment
The text was updated successfully, but these errors were encountered: