civichackingagency / scangov

Government digital experience monitor
https://scangov.org
9 stars 1 forks source link

Cache data files #90

Open Narlotl opened 6 months ago

Narlotl commented 6 months ago

To improve loading times, store data in the browser. https://developer.mozilla.org/en-US/docs/Web/API/Cache

mgifford commented 6 months ago

Lots can be done here. 

Both of these can provide results of a scan of URLs from a sitemap.xml file I believe:
https://unlighthouse.dev/
https://www.sitespeed.io/

There is this type of caching too:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching

Also good info in
https://pagespeed.web.dev/

Narlotl commented 4 months ago

Make it so if the data files are updated, the cache is reset

Narlotl commented 4 months ago

People might have to clear their cache manually for the site to work

Narlotl commented 4 months ago

Make it so if the data files are updated, the cache is reset

This is working, but it takes 2 refreshes. Maybe set the fetch the GitHub update time (and set the text for the updated time display) inside the function that retrieves the data so it can be cleared before old data is sent.