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

Do not persist isSubmitting #26

Open
hendrul opened this issue Sep 2, 2019 · 3 comments
Open

Do not persist isSubmitting #26

hendrul opened this issue Sep 2, 2019 · 3 comments

Comments

@hendrul
Copy link

hendrul commented Sep 2, 2019

If I go back to a persisted form isSubmitting is true
https://codesandbox.io/embed/recursing-hodgkin-bcyvp

@hendrul hendrul changed the title Do not save isSubmitting Do not persist isSubmitting Sep 2, 2019
@leibowitz
Copy link

I noticed when the isSubmitting is set back to false (after submit), the Persist component doesn't seem trigger a component update. I tried checking the comparison in componentDidUpdate to see if the isEqual check might be returning wrong result, but that doesn't seem to be the case.

While trying to fix this, I realised formik-persist is built with an old version of formik (1.x). I tried upgrading to formik 2.x but couldn't get it to work the same way.

Anyhow, in the meantime, I used this as a workaround

{!isSubmitting && <Persist name="form-id" />}

Does the job for me. It might do for you too, but I let you be the judge

@tomcobley
Copy link

The {!isSubmitting && <Persist name="form-id" />} workaround didn't work for me.

A better workaround for this (in my case at least) is to call setFieldValue() without parameters after calling setSubmitting(false) to force the new value of isSubmitting to be persisted.

@fordooo
Copy link

fordooo commented Aug 25, 2023

I was finally able to clear isSubmitting: true by calling window.localStorage.removeItem("form-id") in the onSubmit along with using {!isSubmitting && <Persist name="form-id" />}

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

No branches or pull requests

4 participants