formik-persist icon indicating copy to clipboard operation
formik-persist copied to clipboard

resetForm must be called twice in order to clear values from localstorage

Open kaitlynbrown opened this issue 6 years ago • 1 comments

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

kaitlynbrown avatar Dec 13 '18 22:12 kaitlynbrown

ping @jaredpalmer

xxczaki avatar Apr 19 '19 19:04 xxczaki