Fix: SW controllerchange → Reload erzwingen bei SW-Update (stale api.js im Memory)

This commit is contained in:
rene 2026-04-14 06:30:22 +02:00
parent 86dfe50013
commit 0438bd6bfe
2 changed files with 6 additions and 1 deletions

View file

@ -224,6 +224,11 @@
navigator.serviceWorker.register('/sw.js')
.catch(err => console.log('SW Registration failed:', err));
});
// Wenn ein neuer SW die Kontrolle übernimmt (nach Update),
// Seite neu laden — sonst hat app.js neue Seiten-JS aber altes api.js im Speicher.
navigator.serviceWorker.addEventListener('controllerchange', () => {
window.location.reload();
});
}
</script>

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications
============================================================ */
const CACHE_VERSION = 'by-v23';
const CACHE_VERSION = 'by-v24';
const CACHE_STATIC = `${CACHE_VERSION}-static`;
// Diese Dateien werden beim Install gecacht (App Shell)