diff options
Diffstat (limited to 'build.js')
| -rw-r--r-- | build.js | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -62,7 +62,7 @@ self.addEventListener('message', (e) => { // Activating keeps the previous build's cache beside the new one: a page // launched from the old shell (navigations to / are cache-first, below) keeps // running the old build until its next launch, and its lazily imported chunks -// must still be found. Older caches go. Navigation preload starts a +// must still be found. Older builds' caches go. Navigation preload starts a // navigation's network request while the worker itself is still starting. const META = 'coinos-sw-meta'; self.addEventListener('activate', (e) => { @@ -74,7 +74,8 @@ self.addEventListener('activate', (e) => { const keep = [CACHE, ...order.filter((k) => k !== CACHE)].slice(0, 2); await meta.put('cache-order', new Response(JSON.stringify(keep))); const keys = await caches.keys(); - await Promise.all(keys.filter((k) => k !== META && !keep.includes(k)).map((k) => caches.delete(k))); + // only builds' caches: the thumbnail and call caches outlive a deploy + await Promise.all(keys.filter((k) => k.startsWith('cold-') && !keep.includes(k)).map((k) => caches.delete(k))); await self.clients.claim(); })()); }); |
