Service worker: delete only this app's old caches

Every app on krburchel.github.io shares one cache store, so clearing every
unknown cache wiped the other apps' offline files on each update.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Kevin BurchellandClaude Fable 5.2 committed 2026-11-15 10:23:13 -08:00
1 parent 58696cb8f5
commit a40ee2761a
1 file changed
+2 -1
+2 -1
View File
@@ -23,7 +23,8 @@ self.addEventListener('install', function(e){
self.addEventListener('activate', function(e){
e.waitUntil(
caches.keys().then(function(keys){
return Promise.all(keys.filter(function(k){ return k !== CACHE; })
// Only this app's caches: every app on krburchel.github.io shares one cache store.
return Promise.all(keys.filter(function(k){ return k.indexOf('brainfeed-') === 0 && k !== CACHE; })
.map(function(k){ return caches.delete(k); }));
}).then(function(){ return self.clients.claim(); })
);