komarovalexander / ka-table

Lightweight MIT React Table component with Sorting, Filtering, Grouping, Virtualization, Editing and many more
http://ka-table.com
MIT License
788 stars 58 forks source link

Bug: Rehydrated data from localStorage becomes stale #305

Closed bay-jacewhitten closed 1 year ago

bay-jacewhitten commented 1 year ago

Over time, when persisting data to the local storage, this object is not updated or merged correctly, causing the table to show stale data and column options. This took me several hours to track down why my column dataType was not being updated after I changed my code. I had changed it from String to Object. But my console logged tableProps still showed a string on the columns dataType.

Hard refreshing or new api calls does not solve this. Current solution is to delete storage and reapply and refresh the page. Or do not persist state at all.

komarovalexander commented 1 year ago

Hi @bay-jacewhitten as you can see in https://komarovalexander.github.io/ka-table/#/state-storing demo - all local storage saving work is happening outside of the table, so you have to control that by yourself. This is a good question because I also recently thought that it would be useful to have it as an option in table: https://github.com/komarovalexander/ka-table/issues/294 so I will consider your case once I start working on that

bay-jacewhitten commented 1 year ago

Ah ok, that makes sense. Not sure why I didn't notice that before. Thanks!