From e6d6a3e697f66ee30935cefc8ce79856300a1b53 Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 6 Jun 2026 11:35:03 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Marker=20verschwanden=20offline=20beim?= =?UTF-8?q?=20Kartenbewegen=20=E2=80=94=20SW-503-JSON=20als=20Fehler=20wer?= =?UTF-8?q?ten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der SW beantwortet nicht-cachebare API-GETs offline mit 503 + JSON-Body, r.json() wirft dann NICHT -> Erfolgs-Pfad ersetzte Marker durch {detail:...}. _fetchPois prueft jetzt r.ok + Array.isArray, dadurch greift der IndexedDB-Fallback (MapOffline.pois) in Phase 1 und Phase 2 behaelt den Bestand. Bump v1224 --- VERSION | 2 +- backend/static/index.html | 24 ++++++++++++------------ backend/static/js/app.js | 2 +- backend/static/js/pages/map.js | 14 ++++++++++++-- backend/static/landing.html | 2 +- backend/static/sw.js | 2 +- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/VERSION b/VERSION index de697b5..7aee5ac 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1223 \ No newline at end of file +1224 \ No newline at end of file diff --git a/backend/static/index.html b/backend/static/index.html index 1663fcf..bfd8dd9 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -86,14 +86,14 @@ Ban Yaro - + - - - - - + + + + + @@ -612,11 +612,11 @@ - - - - - + + + + + @@ -626,7 +626,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index c47d15f..204d3f4 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 = '1223'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '1224'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator) window.APP_VERSION = APP_VERSION; diff --git a/backend/static/js/pages/map.js b/backend/static/js/pages/map.js index dd159d0..2692cff 100644 --- a/backend/static/js/pages/map.js +++ b/backend/static/js/pages/map.js @@ -1469,12 +1469,22 @@ window.Page_map = (() => { } } + // POIs holen — WICHTIG: r.ok prüfen! Der SW antwortet offline auf nicht-cachebare + // API-GETs mit 503 + JSON-Body ({detail:…}) → r.json() wirft NICHT, der Erfolgs-Pfad + // liefe mit einem Objekt statt Array weiter und ersetzte die Marker durch nichts. + const _fetchPois = async (params) => { + const r = await fetch(`/api/osm/pois?${params}`); + if (!r.ok) throw new Error(`pois ${r.status}`); + const pois = await r.json(); + return Array.isArray(pois) ? pois : []; + }; + // Phase 1: sofort DB-Daten zeigen (fast=true) _setOsmStatus('Lade…'); const fastTasks = activeLayers.map(async ([layerKey, osmType]) => { const params = new URLSearchParams({ type: osmType, fast: 'true', ...bbox }); try { - const pois = await fetch(`/api/osm/pois?${params}`).then(r => r.json()); + const pois = await _fetchPois(params); _replaceOsmMarkers(layerKey, pois); return pois.length; } catch { @@ -1499,7 +1509,7 @@ window.Page_map = (() => { const freshTasks = activeLayers.map(async ([layerKey, osmType]) => { const params = new URLSearchParams({ type: osmType, ...bbox }); try { - const pois = await fetch(`/api/osm/pois?${params}`).then(r => r.json()); + const pois = await _fetchPois(params); const osmCount = _osmCountOf(layerKey); if (pois.length !== osmCount) _replaceOsmMarkers(layerKey, pois); _done++; diff --git a/backend/static/landing.html b/backend/static/landing.html index dc2f09a..9b7b061 100644 --- a/backend/static/landing.html +++ b/backend/static/landing.html @@ -4,7 +4,7 @@ - + Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz diff --git a/backend/static/sw.js b/backend/static/sw.js index ab823c7..8c51cc9 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -4,7 +4,7 @@ ============================================================ */ // ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab -const VER = '1223'; +const VER = '1224'; const CACHE_VERSION = `by-v${VER}`; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten