From 0438bd6bfe4cef1b6ada78c5f22e647db91771a4 Mon Sep 17 00:00:00 2001 From: rene Date: Tue, 14 Apr 2026 06:30:22 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20SW=20controllerchange=20=E2=86=92=20Relo?= =?UTF-8?q?ad=20erzwingen=20bei=20SW-Update=20(stale=20api.js=20im=20Memor?= =?UTF-8?q?y)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/static/index.html | 5 +++++ backend/static/sw.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/static/index.html b/backend/static/index.html index 15e38e0..93861a4 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -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(); + }); } diff --git a/backend/static/sw.js b/backend/static/sw.js index 66b5211..e379bfe 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -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)