Fix: iOS bfcache — ?_t=timestamp bei Update-Reload, wird sofort aus URL entfernt (SW by-v770)

This commit is contained in:
rene 2026-05-08 11:27:06 +02:00
parent 572fbf642f
commit a1e5364f25
5 changed files with 11 additions and 10 deletions

View file

@ -3,9 +3,11 @@
Router, State-Management, Navigation, Initialisierung.
============================================================ */
const APP_VER = '769'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const APP_VER = '770'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const APP_VERSION = '1.5.0'; // ← semantische Version, wird bei make release gesetzt
const IS_STAGING = location.hostname === 'staging.banyaro.app';
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
if (location.search.includes('_t=')) history.replaceState(null, '', '/');
const App = (() => {
@ -1037,8 +1039,8 @@ const App = (() => {
btn.textContent = 'Lädt…';
btn.disabled = true;
sessionStorage.setItem('by_update_reload', APP_VER);
// Immer zur Root — location.href enthält ggf. Hash der App in alten Zustand navigiert
setTimeout(() => location.replace('/'), 800);
// ?_t= Timestamp zwingt iOS bfcache zur Aufgabe — wird beim Start sofort entfernt
setTimeout(() => location.replace('/?_t=' + Date.now()), 800);
try {
const reg = await navigator.serviceWorker?.getRegistration();
if (reg?.waiting) reg.waiting.postMessage({ type: 'SKIP_WAITING' });

View file

@ -764,11 +764,11 @@ window.Page_settings = (() => {
if (serverVersion && serverVersion !== localVersion) {
if (reg?.waiting) reg.waiting.postMessage({ type: 'SKIP_WAITING' });
UI.toast.info(`Update auf v${serverVersion} — Seite wird neu geladen…`);
setTimeout(() => location.replace('/'), 1500);
setTimeout(() => location.replace('/?_t=' + Date.now()), 1500);
} else if (reg?.waiting) {
reg.waiting.postMessage({ type: 'SKIP_WAITING' });
UI.toast.success('Update wird installiert…');
setTimeout(() => location.replace('/'), 1500);
setTimeout(() => location.replace('/?_t=' + Date.now()), 1500);
} else {
UI.toast.success(`Ban Yaro ist aktuell — Build ${localVersion}`);
}