formik-persist
formik-persist copied to clipboard
resetForm must be called twice in order to clear values from localstorage
Because the componentDidUpdate
method uses prevProps
instead of this.props
, when resetForm
is called, it saves the values that existed in the form before resetting. Because of this, I can reset a form, then when I navigate away from it and then back, all the values that were in the form prior to resetting it reappear.
https://github.com/jaredpalmer/formik-persist/blob/63aeb8f49eb40a1c79b6887675587f9bde7f2bab/src/formik-persist.tsx#L23-L27
My current workaround is to simply call resetForm()
twice. The second time, redux-persist
will correctly save the empty form
ping @jaredpalmer