Fix: _queued-Guard in poison/walks/diary — kein Crash bei SW-gequeuten Requests
Wenn der SW einen POST in die Offline-Queue legt, gibt api.js { _queued: true }
zurück (202). Ohne Guard versuchten poison/walks/diary den Response als echtes
Server-Objekt zu nutzen → undefined lat/lon → Leaflet-Crash, undefined id → Upload-Fehler.
Nach dem Guard wird das Modal nur geschlossen; der QUEUE_PROCESSED-Toast informiert
den User sobald synchronisiert.
- poison.js: _queued guard nach API.poison.report()
- walks.js: _queued guard + try-catch statt navigator.onLine
- diary.js: _queued guard nach API.diary.create()
- SW by-v992, APP_VER 992
This commit is contained in:
parent
f2856b8acb
commit
32fde79a40
6 changed files with 20 additions and 10 deletions
|
|
@ -410,7 +410,7 @@ async def serve_media(path: str, request: _Request):
|
|||
raise _HE(404, "Nicht gefunden.")
|
||||
return _media_response(filepath)
|
||||
|
||||
APP_VER = "991" # muss mit APP_VER in app.js übereinstimmen
|
||||
APP_VER = "992" # muss mit APP_VER in app.js übereinstimmen
|
||||
|
||||
@app.get("/.well-known/assetlinks.json")
|
||||
async def assetlinks():
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '991'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '992'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
||||
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
||||
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
|
||||
|
|
|
|||
|
|
@ -1765,6 +1765,7 @@ window.Page_diary = (() => {
|
|||
UI.toast.success('Eintrag gespeichert.');
|
||||
} else {
|
||||
const created = await API.diary.create(_appState.activeDog.id, payload);
|
||||
if (created?._queued) { UI.modal.close(); return; }
|
||||
if (_newFiles.length > 0) {
|
||||
const { uploaded, exifGps } = await _uploadNewFiles(created.id);
|
||||
created.media_items = uploaded;
|
||||
|
|
|
|||
|
|
@ -543,6 +543,9 @@ window.Page_poison = (() => {
|
|||
|
||||
const created = await API.poison.report(payload);
|
||||
|
||||
// SW hat Request in Queue gelegt (offline) — Modal schließen, kein Marker
|
||||
if (created?._queued) { UI.modal.close(); return; }
|
||||
|
||||
// Foto hochladen
|
||||
if (photoInput?.files[0]) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1186,14 +1186,20 @@ window.Page_walks = (() => {
|
|||
_renderList();
|
||||
_renderMarkers();
|
||||
} else {
|
||||
if (!navigator.onLine) {
|
||||
_addPending(payload);
|
||||
UI.modal.close();
|
||||
UI.toast.success('Offline gespeichert — wird synchronisiert sobald Verbindung besteht.');
|
||||
_loadData();
|
||||
return;
|
||||
let created;
|
||||
try {
|
||||
created = await API.walks.create(payload);
|
||||
} catch (netErr) {
|
||||
if (netErr instanceof TypeError || !navigator.onLine) {
|
||||
_addPending(payload);
|
||||
UI.modal.close();
|
||||
UI.toast.success('Offline gespeichert — wird synchronisiert sobald Verbindung besteht.');
|
||||
_loadData();
|
||||
return;
|
||||
}
|
||||
throw netErr;
|
||||
}
|
||||
const created = await API.walks.create(payload);
|
||||
if (created?._queued) { UI.modal.close(); _loadData(); return; }
|
||||
_data.unshift({ ...created, teilnehmer_count: 0 });
|
||||
UI.toast.success('Treffen geplant! 🎉');
|
||||
UI.modal.close();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Offline-Cache + Push Notifications + Tile-Cache
|
||||
============================================================ */
|
||||
|
||||
const CACHE_VERSION = 'by-v991';
|
||||
const CACHE_VERSION = 'by-v992';
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue