Offline access: also save what the app needs to start
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 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,18 @@ async function fetchOnce(url: string): Promise<string | null> {
|
||||
|
||||
async function run(): Promise<void> {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user