Fix: Step 4 toleranter + Prefetch im 60s-Interval, SW by-v1092

Step 4 verlangte alle 3 von expenses/routes/notes — einer fehlte
(vermutlich notes 401 weil beim Prefetch noch nicht eingeloggt) →
Pfote weiß. Jetzt reichen 2 von 3.

Außerdem läuft _prefetchData() nicht nur beim Init + 2/5/10/20s-
Retries, sondern auch alle 60s mit refresh() — falls Login erst
spät erfolgt, kommt die fehlende API beim nächsten Tick.
This commit is contained in:
rene 2026-05-26 18:22:20 +02:00
parent 0ba0de12b3
commit 66d2d96a2f
5 changed files with 18 additions and 15 deletions

View file

@ -3,7 +3,7 @@
Router, State-Management, Navigation, Initialisierung.
============================================================ */
const APP_VER = '1091'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const APP_VER = '1092'; // ← 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;

View file

@ -63,9 +63,12 @@ window.OfflineIndicator = (() => {
const c = await caches.open(CACHE_API).catch(() => null);
if (!c) return false;
const urls = (await c.keys()).map(r => r.url);
return urls.some(u => u.includes('/api/expenses'))
&& urls.some(u => u.includes('/api/routes'))
&& urls.some(u => u.includes('/api/notes'));
const found = [
urls.some(u => u.includes('/api/expenses')),
urls.some(u => u.includes('/api/routes')),
urls.some(u => u.includes('/api/notes')),
].filter(Boolean).length;
return found >= 2; // 2 von 3 — toleriert wenn z.B. notes 401 lieferte
} },
{ step: 5, title: 'Karten-Kacheln',
@ -272,7 +275,7 @@ window.OfflineIndicator = (() => {
if (e?.data?.type === 'CACHE_TILES_PROGRESS') refresh();
});
}
setInterval(refresh, 60_000);
setInterval(() => { _prefetchData(); refresh(); }, 60_000);
}
return { init, refresh, openStatus };