From e397b9dff5ed6d298803be71b4e0596e929bc590 Mon Sep 17 00:00:00 2001 From: rene Date: Thu, 14 May 2026 12:34:26 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20SW-Cache=20/api/dogs=20nach=20Foto-Uploa?= =?UTF-8?q?d=20l=C3=B6schen=20(SW=20by-v937)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _renderHund() liest Hunde aus _cachedGet('/dogs') — SW-gecacht mit altem foto_url. Fix: swCacheDelete für /api/dogs, /api/dogs/{id} + welcome-dashboard, plus w3_dogs. --- backend/main.py | 2 +- backend/static/js/app.js | 2 +- backend/static/js/pages/dog-profile.js | 6 ++++++ backend/static/sw.js | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/main.py b/backend/main.py index b3a9124..2496738 100644 --- a/backend/main.py +++ b/backend/main.py @@ -406,7 +406,7 @@ async def serve_media(path: str, request: _Request): raise _HE(404, "Nicht gefunden.") return _media_response(filepath) -APP_VER = "936" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "937" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/static/js/app.js b/backend/static/js/app.js index ed72597..cd0ced3 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '936'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '937'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.5.1'; // ← semantische Version, wird bei make release gesetzt const IS_STAGING = location.hostname === 'staging.banyaro.app'; // Cache-Bust-Parameter nach Update-Reload sofort entfernen diff --git a/backend/static/js/pages/dog-profile.js b/backend/static/js/pages/dog-profile.js index 13fbe76..95aa123 100644 --- a/backend/static/js/pages/dog-profile.js +++ b/backend/static/js/pages/dog-profile.js @@ -772,6 +772,9 @@ window.Page_dog_profile = (() => { // localStorage + SW-Cache invalidieren const userId2 = _appState.user?.id || 'anon'; localStorage.removeItem(`w3_bg3_${userId2}_` + new Date().toISOString().slice(0, 10)); + localStorage.removeItem('w3_dogs'); + API.swCacheDelete('/api/dogs'); + API.swCacheDelete(`/api/dogs/${dog.id}`); API.swCacheDelete(`/api/dogs/${dog.id}/welcome-dashboard`); UI.modal.close(); App.renderDogSwitcher?.(); @@ -1390,6 +1393,9 @@ window.Page_dog_profile = (() => { // localStorage + SW-Cache invalidieren damit Welten das neue Foto zeigen const userId = _appState.user?.id || 'anon'; localStorage.removeItem(`w3_bg3_${userId}_` + new Date().toISOString().slice(0, 10)); + localStorage.removeItem('w3_dogs'); + API.swCacheDelete('/api/dogs'); + API.swCacheDelete(`/api/dogs/${saved.id}`); API.swCacheDelete(`/api/dogs/${saved.id}/welcome-dashboard`); } catch { UI.toast.warning('Profil gespeichert, Foto konnte nicht hochgeladen werden.'); diff --git a/backend/static/sw.js b/backend/static/sw.js index 4fa2787..ce2b895 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -3,7 +3,7 @@ Offline-Cache + Push Notifications + Tile-Cache ============================================================ */ -const CACHE_VERSION = 'by-v936'; +const CACHE_VERSION = 'by-v937'; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache