Fix: SW controllerchange → Reload erzwingen bei SW-Update (stale api.js im Memory)
This commit is contained in:
parent
86dfe50013
commit
0438bd6bfe
2 changed files with 6 additions and 1 deletions
|
|
@ -224,6 +224,11 @@
|
||||||
navigator.serviceWorker.register('/sw.js')
|
navigator.serviceWorker.register('/sw.js')
|
||||||
.catch(err => console.log('SW Registration failed:', err));
|
.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>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Offline-Cache + Push Notifications
|
Offline-Cache + Push Notifications
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const CACHE_VERSION = 'by-v23';
|
const CACHE_VERSION = 'by-v24';
|
||||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||||
|
|
||||||
// Diese Dateien werden beim Install gecacht (App Shell)
|
// Diese Dateien werden beim Install gecacht (App Shell)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue