Skip to content
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 should reinitialize this.initialValues even if nextValues is not provided #441

Closed
istarkov opened this issue Feb 15, 2018 · 2 comments · Fixed by #444
Closed

Comments

@istarkov
Copy link
Contributor

istarkov commented Feb 15, 2018

Bug, Feature, or Question?

IMO Bug ;-)

Current Behavior

Calling resetForm without nextValues causing that dirty stay equal to true, because this.initialValues is not updated.

Desired Behavior

resetForm should also reset this.initialValues so dirty flag will be equal to false after reset.

Suggested Solutions

change this 3 lines https://github.com/jaredpalmer/formik/blob/master/src/formik.tsx#L574-L576

    if (nextValues) {
      this.initialValues = nextValues;
    }

on this

this.initialValues = nextValues ? nextValues : this.props.initialValues;
@jaredpalmer
Copy link
Owner

Yeah I think you are right. Can you submit a PR with a test?

@istarkov
Copy link
Contributor Author

Yep, will do, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants