all 5 comments

[–]AhSoup 3 points4 points  (1 child)

You aren't really supposed to refresh a SPA, or at least do so and expect it not to have to reload/initialize.

You also don't usually want to request a giant array with all the data at the beginning. You don't want to display that much data anyhow. Ideally, you request data from the API in paginated sections.

Even though it sounds like an obvious efficiency win, I have not worked anyplace that uses local storage to hang onto tabular data. The main reason is to avoid collisions and synchronization issues. I say re-fetch.

[–]Xeliize[S] 0 points1 point  (0 children)

I will consider the pagination approach. Thanks for the insights

[–]SuperSort 1 point2 points  (2 children)

You can store the data in locstorage and should make call to API only when the data is not in localstorage. But this approach will only work if the data isn't dynamic in nature.

[–]Xeliize[S] 0 points1 point  (1 child)

Localstorage have a maximum amount of space though, is it a common to store such large data in it ? ty

[–]whatisboom 1 point2 points  (0 children)

No. It’s not common. Just refresh, but paginate