If you are calling resetForm({values}) with values of nested objects the dirty and isValid state is still true.
As in v1 dirty and isValid state should be false after calling resetForm({values}) with the new values.
v1.5.8: https://codesandbox.io/s/formik-codesandbox-template-tkqcc
v2.0.3: https://codesandbox.io/s/formik-codesandbox-template-076j5
| Software | Version(s) |
| ---------------- | ---------- |
| Formik | 2.0.3
| React | 16.11.0
Does the sandbox show the isValid issue as well? I wasn't sure how to reproduce it. I've created pull request #1986 to solve the dirty part at least.
I just noticed that the isValid state is also true. And in v1 it is false. The sandbox should show it. Don't know if it is intended so?
Thanks for your work! 馃憦
I'm also experiencing this issue. I tested the PR @Tigge has open, and can verify it fixes the issue.
@simmco for isValid I think this is to be expected in version 2. The isInitialValid (which defaulted to false) is now deprecated, and replaced with initialErrors (which defaults to {}, meaning no errors).
This is a good change, and while isInitialValid is deprecated but still usable in version 2, so you can get the same behaviour by setting it to false. But if you want to start with an invalid form it is better to set initialErrors instead.
Any updates on this one ? how to workaround the dirty set to true even after resetForm({values}) ?
Most helpful comment
Any updates on this one ? how to workaround the
dirtyset totrueeven afterresetForm({values})?