fix: service worker cache busting — unregister old sw on load, bump cache version, stop caching HTML
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m53s

- Bump sw.js cache from v2 to v3
- Unregister all old service workers on page load
- Stop caching HTML/navigation (caused stale CSS refs after rebuild)
This commit is contained in:
openhands committed 2026-07-24 13:50:45 +02:00
1 parent b37b6bc2b9
commit c432d4e95d
7 files changed
+37 -38

No files matched your search

+3 -11
View File
@@ -1,5 +1,5 @@
const CACHE = "atom-v2";
const API_CACHE = "atom-api-v2";
const CACHE = "atom-v3";
const API_CACHE = "atom-api-v3";
self.addEventListener("install", () => self.skipWaiting());
@@ -60,14 +60,6 @@ self.addEventListener("fetch", (event) => {
}
if (req.mode === "navigate") {
event.respondWith(
fetch(req)
.then((res) => {
const copy = res.clone();
caches.open(CACHE).then((c) => c.put(req, copy)).catch(() => {});
return res;
})
.catch(() => caches.match(req).then((hit) => hit || caches.match("/"))),
);
event.respondWith(fetch(req));
}
});