skalnik / aqi-wtf

😷 WTF is the AQI near me right now?!
https://aqi.wtf
MIT License
44 stars 12 forks source link

A slightly more real pass at caching the sensor list #41

Closed obra closed 3 years ago

obra commented 3 years ago

Store the sensor list in localstorage. Hopefully fail gracefully when it goes wrong. Throw away the cached data if it's been more than a day or there's a version mismatch.

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/skalnik/aqi-wtf/1mfdxzrbq
✅ Preview: https://aqi-wtf-git-fork-obra-cache-sensor-list.skalnik.vercel.app

obra commented 3 years ago

It looks like Prettier didn't hate it, but just failed to run. (Of course, Prettier -may- hate it)

skalnik commented 3 years ago

It looks like Prettier didn't hate it, but just failed to run. (Of course, Prettier -may- hate it)

Ah weird, seems like the action fails to run. I think this is due to a limitation of GitHub actions not running in a fork. I'll go ahead and disable it for PRs for less noise. The clean up will still happen when code lands in main.

skalnik commented 3 years ago

❤️ Overall this looks great! We can do this in a follow up, but I think maybe we should still add some manual way to clear out the cache. We can detect a key bind or add a URL parameter or something. Thank you so much for this!

obra commented 3 years ago

❤️ Overall this looks great! We can do this in a follow up, but I think maybe we should still add some manual way to clear out the cache. We can detect a key bind or add a URL parameter or something. Thank you so much for this!

Key binds and URL params aren't workable for PWAs that have been saved to a homescreen on a phone. Instead, I added clickable link in the lower right corner of the page.

obra commented 3 years ago

(This is once again ready for review)