Open JoaoCnh opened 6 years ago
Also having the same issue when trying to remove form from localstorage.
@jaredpalmer @bogdansoare I'm not really sure how this should be handled. I don't really understand why the Persist component is saving the form status after submition. Maybe using componentWillUnmount for some cleanup?
When you submit the form you could try calling actions.resetForm();
@Ciaran0 Will try tomorrow maybe. Will report back if it works
I'm also interested in this as I'm building a checkout form and don't want to persist the customer's credit card number after their transaction.
Ideally I'd rather not store the card number in localStorage at all, but haven't found a good way to avoid doing that yet. If anyone also has this use case and has found a solution, I'd love to see it.
Yes, it would be nice to remove the form handling states from the persistence and only store the form values. I see that it uses the formik context inside, so maybe we could modify the props to provide some kind of configuration object to define which formik props to store in localstorage.
Currently i use the status.success
to show the user a success screen, but this will also get persisted, so the next reload the success screen keeps displaying.
I'm using Persist in forms and I want them persisted while the user hasn't submitted the form. Once the user submits the form it should clean up. So what I did was onSubmit I use localStorage.removeItem("form-name");
That works and removes but just ms later it creates a new entry in localStorage again.
My specific state structure is a simple success boolean. If true it returns just a success component and if not renders the form.
What could be happening? I assumed that without any component rendering it wouldn't submit more entries to localStorage