From 65691e26da8d9b239da81b1169e44bb06685e469 Mon Sep 17 00:00:00 2001 From: ScreenTinker Date: Fri, 5 Jun 2026 15:22:24 -0500 Subject: [PATCH] chore(admin-sw): bump cache to v3 to evict stale clients Force returning browsers to drop the old service-worker cache bucket so the new platform Users "Add user" button lands. The SW is already network-first; bumping CACHE (rd-admin-v2 -> v3) changes the SW bytes, which makes the browser detect a new worker and run activate(), deleting every cache key != CACHE. Also rescues any client still stuck on the pre-v2 cache-first worker. Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend/sw-admin.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/sw-admin.js b/frontend/sw-admin.js index 26575ba..332415d 100644 --- a/frontend/sw-admin.js +++ b/frontend/sw-admin.js @@ -1,8 +1,12 @@ -// Service worker for the admin SPA. Bumped to v2 to invalidate the cache-first -// caches that were shipping stale JS to existing clients (the server already -// sends Cache-Control: no-cache + ETag, but the previous SW intercepted before -// any of that mattered). Strategy is now network-first with offline fallback. -const CACHE = 'rd-admin-v2'; +// Service worker for the admin SPA. Strategy is network-first with offline +// fallback (the server sends Cache-Control: no-cache + ETag, so 304s stay fast). +// Cache name is bumped on each release that must invalidate stale client caches: +// v2 - first network-first version (replaced a cache-first SW that shipped stale JS) +// v3 - force returning clients to drop the old bucket so the "Add user" admin +// button (and any client still on a pre-v2 cache-first SW) lands. +// Changing this string is what makes the browser detect a new SW + run activate, +// which deletes every cache key != CACHE below. +const CACHE = 'rd-admin-v3'; self.addEventListener('install', e => { e.waitUntil(caches.open(CACHE).then(c => c.addAll([