Cache the status page's poll in localStorage, 30 minutes

The previous setInterval(refresh, ...) reset on every page load, so
refreshing the tab reset the clock and could poll far more often than
intended. Now the result is cached client-side with a timestamp: a
reload within 30 minutes renders instantly from that cache and never
hits the network, only scheduling the next real fetch for whatever
time is left in the window. A stale cache still renders immediately
(no flash of dashes) while the real fetch happens right behind it.

localStorage access is wrapped in try/catch on both read and write;
some private-browsing modes throw rather than just being empty, and
a failure there should degrade to "always fetch", not break the page.

Verified with 4 scenarios against the actual rendered script (no
cache fetches immediately and sets the interval; a 5-minute-old cache
renders without fetching and schedules for the ~25 minutes remaining;
a 40-minute-old cache shows the old value first then refetches
immediately; corrupted localStorage falls back to a normal fetch
without throwing).
nccommitted parent 42557a1c2fc874db4dab2452810eb59a8532b574dd633c3Browse files
2 files changed+55−8

Rendering diff…