From a60cd1fc3318e644f6dd8de5e8d6e3f756ff6d5b Mon Sep 17 00:00:00 2001 From: Lukas Remis Date: Mon, 5 Oct 2026 19:17:53 +0200 Subject: [PATCH] Offline access: also save what the app needs to start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The app asks who is signed in, the accounts and the folders once, when it loads — before the service worker exists if offline access was just turned on. Without a reload those were never saved, so going offline ended on "Can't reach the server". Pre-loading now fetches them too. Co-Authored-By: Claude Opus 5.5 --- frontend/src/lib/offlinePrefetch.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/src/lib/offlinePrefetch.ts b/frontend/src/lib/offlinePrefetch.ts index 6878e98..2a42941 100644 --- a/frontend/src/lib/offlinePrefetch.ts +++ b/frontend/src/lib/offlinePrefetch.ts @@ -37,6 +37,18 @@ async function fetchOnce(url: string): Promise { async function run(): Promise { if (!(await offlineReady()) || isOffline()) return; + // What the app asks for when it starts (who is signed in, accounts, folders…). + // The page fetched these once on load — possibly before the service worker + // was there to save them — so fetch them again now, or the app could not + // start offline at all. + await Promise.allSettled([ + api.me(), + api.accounts(), + api.mailboxes(), + api.quota(), + api.savedSearches(), + api.uiManifest(), + ]); const settings = await api.settings(); const order = settings.thread_order ?? "asc"; // The list as the app shows it (newest first is the default), plus the other