-
-
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
Fix dirty flag when calling resetForm with current values #1986
Fix dirty flag when calling resetForm with current values #1986
Conversation
When you are resetting the form using `resetForm` and specify current formik values as the next state the dirty hook won't be run since the current values didn't change. This adds `intialValues.current` as a dependency so the hook will run again if either of these changes. This fixes the dirty part of issue jaredpalmer#1976.
@jaredpalmer any chance of getting this merged? |
Thanks to you guys for all the awesome work. I hate to be that guy, but is there an ETA on this? For my projects, this is core functionality. Currently, I have no way to set |
@babalugats76 This has already been merged and was released in v2.0.7. |
Thanks @Tigge! Looks like I need to do some more testing. I am using Update I pretty much had to set For me, I have a situation in which I start with a blank form--without a back-end database record. Originally, I was using On subsequent saves, however, I want to simply use This is what I ended up with (inside my
In the above record, Basically, I just converted everything over to If I am barking up the wrong tree, definitely let me know! |
When you are resetting the form using
resetForm
and specify currentformik values as the next state the dirty hook won't be run since the
current values didn't change. This adds
intialValues.current
as adependency so the hook will run again if either of these changes.
This fixes the dirty part of issue #1976.