Hotfix: SW null-Response Bug — catch gibt 503 statt undefined zurück (Safari FetchEvent-Fehler) (SW by-v774)

This commit is contained in:
rene 2026-05-08 12:27:50 +02:00
parent ce14bb1d2c
commit 8467f01b5b
4 changed files with 8 additions and 8 deletions

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications + Tile-Cache
============================================================ */
const CACHE_VERSION = 'by-v773';
const CACHE_VERSION = 'by-v774';
const CACHE_STATIC = `${CACHE_VERSION}-static`;
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
@ -292,7 +292,8 @@ self.addEventListener('fetch', event => {
}
return response;
})
.catch(() => caches.match(event.request))
.catch(() => caches.match(event.request)
.then(cached => cached || new Response('', { status: 503 })))
);
return;
}
@ -324,9 +325,8 @@ self.addEventListener('fetch', event => {
})
)
.catch(() => {
if (event.request.mode === 'navigate') {
return caches.match('/');
}
if (event.request.mode === 'navigate') return caches.match('/');
return new Response('', { status: 503 });
})
);
});