Fix: Sidebar via JS-Inline-Styles (SW-Cache-unabhängig) + SW force-navigate

_openSidebar() setzt nun direkt style.cssText statt CSS-Klassen,
damit stale CSS-Cache keinen Einfluss hat. SW by-v30 → by-v31 mit
clients.navigate() im activate-Handler für automatischen Reload.
This commit is contained in:
rene 2026-04-14 17:22:13 +02:00
parent 40b802ae86
commit b6fae96334
2 changed files with 22 additions and 3 deletions

View file

@ -193,12 +193,28 @@ const App = (() => {
}
function _openSidebar() {
document.getElementById('sidebar')?.classList.add('open');
const sidebar = document.getElementById('sidebar');
if (!sidebar) return;
// Inline-Styles: unabhängig vom CSS-Cache-Stand
sidebar.style.cssText = [
'display:flex',
'position:fixed',
'top:0', 'left:0', 'bottom:0',
'width:240px',
'z-index:2000',
'background:var(--c-surface,#fff)',
'flex-direction:column',
'overflow:hidden',
'box-shadow:4px 0 24px rgba(0,0,0,0.22)',
'border-right:1px solid var(--c-border-light,#eee)',
].join(';');
document.getElementById('sidebar-backdrop')?.classList.add('visible');
}
function _closeSidebar() {
document.getElementById('sidebar')?.classList.remove('open');
const sidebar = document.getElementById('sidebar');
if (!sidebar) return;
sidebar.style.cssText = ''; // alle Inline-Styles weg → CSS übernimmt wieder
document.getElementById('sidebar-backdrop')?.classList.remove('visible');
}

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications
============================================================ */
const CACHE_VERSION = 'by-v30';
const CACHE_VERSION = 'by-v31';
const CACHE_STATIC = `${CACHE_VERSION}-static`;
// Diese Dateien werden beim Install gecacht (App Shell)
@ -40,6 +40,9 @@ self.addEventListener('activate', event => {
keys.filter(k => k !== CACHE_STATIC).map(k => caches.delete(k))
))
.then(() => self.clients.claim())
// Alle offenen Fenster neu laden, damit neues CSS/JS aktiv wird
.then(() => self.clients.matchAll({ type: 'window' }))
.then(clients => clients.forEach(c => c.navigate(c.url)))
);
});