Performance pattern If your web app requires a lot of data that changes...


Performance pattern

If your web app requires a lot of data that changes rarely:

1. Store the data in localStorage.

2. When the user returns, read from localStorage. Fast. 👍

3. Check the data’s version.

4. If localStorage data is an old version, request new data via HTTP.
Version each piece of data stored in localStorage.

Send these version numbers down in your app’s initial payload.

This saves an HTTP request (because you don’t have to make another HTTP request to get the current version for each piece of data from the server).

View original on X