feat(offline): auto-detect no network at cold start + go-offline dialog [PR1] #202
Reference in New Issue
Block a user
Delete Branch "feature/offline-autodetect"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Offline mode — PR1 of the auto-detect (the design we settled together). Closes the last cold-start gap: a sticky-online launch with no network hung the splash on adoptSession's retrying profile fetch.
Behaviour (offline-capable web install with a cached profile)
navigator.onLine === false) → enter offline mode for the session (no dialog — unambiguous; the next launch re-evaluates). Session-only, not sticky.Pieces
connection.svelte:checkReachable(timeoutMs)— a bounded single probe.offline.svelte:setOfflineMode(on, persist)— auto-offline is session-only, a deliberate choice is sticky (the auto-vs-deliberate distinction PR2 leans on).app.svelte.ts: the auto-detect inbootstrap+ the dialog resolver;App.svelterenders the boot dialog. i18n en/ru.Flags
profile.get) + adoptSession'sprofile.getare two reads. Kept for safety (not restructuring the widely-usedadoptSession); can optimise later if cold-start latency bites.Tests
Online cold-start unaffected — the auto-detect is gated to
isStandalone(), false in Playwright, sobootstrap's online/login flows are unchanged: e2e 196. check 0, unit 479, gate 113.3 / 114. The offline paths are contour-verified (the mock e2e cannot be a standalone PWA with no network) — please test: install → turn network off → relaunch (should auto-offline, no dialog); and a flaky/blocked connection (interface up) → the dialog.Next: PR2 — mid-session flight-mode reactivity via passive
online/offlineevents (+ CapacitorNetwork.addListener), with auto-offline self-heal vs deliberate-offline-stays.