mirror of
https://github.com/screentinker/screentinker.git
synced 2026-06-14 18:22:46 -06:00
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) <noreply@anthropic.com>
This commit is contained in:
parent
400872f8ea
commit
65691e26da
|
|
@ -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([
|
||||
|
|
|
|||
Loading…
Reference in a new issue