Fix: iOS SW-Update — SKIP_WAITING Handler, location.replace() statt reload(), no-store Header (SW by-v762)

This commit is contained in:
rene 2026-05-07 19:22:22 +02:00
parent a8b4fd781f
commit a3c8d77a14
4 changed files with 20 additions and 14 deletions

View file

@ -578,7 +578,7 @@
<script src="/js/api.js?v=94"></script>
<script src="/js/ui.js?v=94"></script>
<script src="/js/app.js?v=94"></script>
<script src="/js/worlds.js?v=761"></script>
<script src="/js/worlds.js?v=762"></script>
<!-- Feature-Seiten werden lazy geladen -->
@ -640,7 +640,8 @@
// Wenn neuer SW die Kontrolle übernimmt → Seite neu laden
navigator.serviceWorker.addEventListener('controllerchange', () => {
window.location.reload();
// location.replace statt reload() — bypassed iOS bfcache
window.location.replace(window.location.href);
});
navigator.serviceWorker.addEventListener('message', e => {

View file

@ -3,7 +3,7 @@
Router, State-Management, Navigation, Initialisierung.
============================================================ */
const APP_VER = '761'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const APP_VER = '762'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const APP_VERSION = '1.5.0'; // ← semantische Version, wird bei make release gesetzt
const IS_STAGING = location.hostname === 'staging.banyaro.app';
@ -1045,7 +1045,8 @@ const App = (() => {
const keys = await caches.keys();
await Promise.all(keys.map(k => caches.delete(k)));
} catch { /* ignorieren */ }
setTimeout(() => location.reload(), 600);
// location.replace bypassed iOS bfcache (reload() stellt alte Seite wieder her)
setTimeout(() => location.replace(location.href), 600);
});
}

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications + Tile-Cache
============================================================ */
const CACHE_VERSION = 'by-v761';
const CACHE_VERSION = 'by-v762';
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
@ -344,6 +344,10 @@ self.addEventListener('sync', event => {
// MESSAGE — Tile-Vorausladung (Offline-Speicherung) + Queue-Steuerung
// ----------------------------------------------------------
self.addEventListener('message', event => {
if (event.data?.type === 'SKIP_WAITING') {
self.skipWaiting();
return;
}
if (event.data?.type === 'PROCESS_QUEUE') {
event.waitUntil(_processQueue());
return;