update caching strategy
Hunter
Tuesday, March 10th, 2026 at 12:09 AM
-const CACHE_NAME = 'matryoshka-v1.4';
1 +const CACHE_NAME = 'matryoshka-v1.5';
2 const ASSETS = [
3 './',
4 'index.html',
43 // Serve from cache, fall back to network, and update cache
44 self.addEventListener('fetch', (event) => {
45 event.respondWith(
- caches.match(event.request).then((cached) => {
46 + caches.open(CACHE_NAME).then((cache) => cache.match(event.request)).then((cached) => {
47 const fetchPromise = fetch(event.request).then((response) => {
48 // Only cache same-origin, successful GET requests
49 if (response.ok && event.request.method === 'GET') {