Disable stale dashboard service worker cache

This commit is contained in:
James Smith
2026-03-19 00:01:47 +00:00
parent 981b103b90
commit ac445184b6
4 changed files with 47 additions and 119 deletions

View File

@@ -16337,11 +16337,20 @@
</div>
</div>
<!-- PWA Service Worker Registration -->
<!-- Disable legacy static-asset service worker to avoid stale dashboard JS/CSS -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/static/sw.js').catch(() => {});
navigator.serviceWorker.getRegistrations()
.then((registrations) => Promise.all(registrations.map((registration) => registration.unregister())))
.catch(() => {});
if ('caches' in window) {
caches.keys()
.then((keys) => Promise.all(
keys.filter((key) => key.startsWith('intercept-')).map((key) => caches.delete(key))
))
.catch(() => {});
}
});
}
// Initialize global core modules after page load