-
-
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
Dirty handling workflow #195
Comments
let me try in a codesandbox |
Is save supposed to actually submit the |
yes "save" is either clicking the submit button or hitting enter from an appropriate form |
Second part of this (returning to "pristine" after save) seems to be accomplished by calling |
Here's my config for reference: [UPDATED] const container = withFormik({
handleSubmit: (values, { props, resetForm }) =>
props
.handleSubmit(omit(['httpProxy', 'httpsProxy'], values))
.then(compose(resetForm, get('settings')))
.catch(ary(0, resetForm)),
mapPropsToValues: get('data'),
validateOnBlur: false,
validateOnChange: true,
validationSchema: yup.object({
dtrHost: yup.string().required(),
webTlsCA: yup.string().required(),
webTlsCert: yup.string().required(),
}),
}); |
Yes that's what happens when you pass values to |
I think this is what you want. https://codesandbox.io/s/0qr1wkp49w |
Very close but I actually need |
hmmm....don't think so I think we should mutate |
Does that fix the issue with dirty not toggling |
I had assumed on first use that |
|
Thank you, looks like this is going to work fine (just have to do a shallow equal check since
|
Released in 0.9.4 |
How do we test dirty in HOC withFormik. In the documentation I see that isDirty is there in the Render formik but I didnt see it being there with withFormik use.Just wanted to know if we can use isInitialValid for the same dirty check there |
Was really surprised to learn that |
#197 fixed the issue. To have the buttons disabled when they should: <Button
disabled={!dirty || isSubmitting}
type="submit"
onClick={() => {
resetForm({ values });
submitForm();
}}
> |
Trying to implement a workflow as follows:
Users sees a pristine form, save button is hidden => user begins typing in input, form becomes dirty, save button is shown => user saves, form becomes pristine, save button is hidden
Is this currently possible in formik?
dirty
is remaining as false for me up until the form submitted and is never reset afterwardsThe text was updated successfully, but these errors were encountered: