jaredpalmer / formik-persist

💾 Persist and rehydrate a Formik form to localStorage
MIT License
377 stars 56 forks source link

Form state only saved once #12

Open alarinn opened 6 years ago

alarinn commented 6 years ago

I have this SPA that has a TabView (Primereact) where one tab sit s a Formik component, another eventually to display a DataTable, another with an iframe showing an app from another server, and then another tab for future content. At first, the form data would disappear when I changed tabs, but then I tried formik-persist and it works once. I can enter data on the form and then change tabs and come back and the data is still there. But, if I do nothing in the form and repeat the steps, the next time I come back to the form, everything has been reset. I tried looking at what you did in the persist code to see why the storage is treated like per request, but wasn't able to determine why the persisted data would reset. I'm under a tight deadline so moving on for now and come back to this later. I know at some point I might need to add Redux for persisting the datatables, but was hoping for a quick fix.

alarinn commented 6 years ago

So without requirements, the screen changed again. So now I have my data table where I can select a record which routes me to my form with data populated. Now if I go back and select a new record, the old record is displayed. I have to go back and select the record again before it shows up in the form. I can see the new record in the MapPropsToValues. I had to remove for now.

phuongthuan commented 6 years ago

@alarinn same here