feat: cache-control overhaul so visual changes propagate immediately
CI / Lint (push) Successful in 14s
CI / Test (push) Successful in 12s
CI / Build & Push (push) Successful in 32s

Per-file content-hash versioning on every /static reference, immutable cache
headers on versioned URLs, no-cache on HTML, auto-bumped service worker cache
name with stale-while-revalidate for assets, and a controllerchange listener
that silently reloads the page when a new SW takes control.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-19 20:11:36 -04:00
parent aaa0899506
commit 7d1649d278
7 changed files with 110 additions and 27 deletions
+6
View File
@@ -417,5 +417,11 @@ window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js').catch(err => {
console.warn('Service worker registration failed:', err);
});
let reloading = false;
navigator.serviceWorker.addEventListener('controllerchange', () => {
if (reloading) return;
reloading = true;
location.reload();
});
}
});