Skip to content

feat(language): implement timeout handling in initLanguage to prevent splash screen stalling - #1972

Open
MrDirkelz wants to merge 3 commits into
mainfrom
1962-app-white-screen-after-the-app-has-been-backgrounded-for-a-while
Open

feat(language): implement timeout handling in initLanguage to prevent splash screen stalling#1972
MrDirkelz wants to merge 3 commits into
mainfrom
1962-app-white-screen-after-the-app-has-been-backgrounded-for-a-while

Conversation

@MrDirkelz

Copy link
Copy Markdown
Collaborator

No description provided.

@MrDirkelz MrDirkelz linked an issue Aug 31, 2026 that may be closed by this pull request
@MrDirkelz
MrDirkelz force-pushed the 1962-app-white-screen-after-the-app-has-been-backgrounded-for-a-while branch from 3e71c89 to 5260324 Compare August 31, 2026 11:00
@MrDirkelz MrDirkelz self-assigned this Aug 31, 2026

@johan-bell johan-bell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach is sound — bounding the never-settling boot promises with a static splash and live watchers means a timed-out boot still lands in a usable, self-healing state. A few blockers before this can go in:

  • shared/src/db/database.ts:915 — the 10s DB_OPEN_TIMEOUT_MS wraps db.open(), which also runs Dexie version upgrades; a bumped index string re-indexes the whole docs table (incl. the multi-entry *fts index), so a full-corpus client on a slow device can exceed 10s and hard-fail into the error splash, where Reload just restarts the upgrade. Bound only the blocked/no-answer case (the blocked handler at :906 already detects it).
  • app/src/main.ts:43 — the 45s watchdog only shows visible UI before app.mount(); after mount the static splash is gone and App.vue's loading splash has no error state, so a post-mount stall is still an endless spinner.
  • app/src/globalConfig.ts:274 — the new LANGUAGE_BOOT_TIMEOUT_MS block landed between initLanguage's JSDoc and the function, so the doc now documents the constant.
  • Comment style: several added comments narrate the bug/previous behaviour at multi-sentence length (database.ts:912, globalConfig.ts:278, main.ts:36, and the spec file headers) — that context belongs in the PR description, which is currently empty.
  • Tests: initLanguage.spec.ts tests globalConfig (existing initLanguage tests live in globalConfig.spec.ts) and burns the real 5s timeout twice — fake timers would keep the suite fast.

@johan-bell

Copy link
Copy Markdown
Collaborator

Follow-up after a deeper hands-on pass: the two blockers in my review stand, with one softening on the first — the 10s timeout rejects the boot promise but does not abort the underlying Dexie open, so a legitimate schema upgrade continues in the background and a later reload can succeed. The user still lands on the error splash mid-upgrade though, so bounding only the blocked/no-answer case remains the ask.

Also flagging: #1974 introduces a static boot splash for the same window (in index.html, outside #app, removed after full startup). Both PRs can't merge as-is — worth converging with Chris on one implementation. This PR's error/reload panel, nosplash and prefers-reduced-motion handling plus #1974's placement (it covers the post-mount initLanguage window too, which would also close my second blocker about the watchdog having no visible UI after mount) would combine into the complete fix.

@MrDirkelz
MrDirkelz force-pushed the 1962-app-white-screen-after-the-app-has-been-backgrounded-for-a-while branch from 5260324 to 69eb7b7 Compare September 1, 2026 11:19
Both this branch and #1974 add a static boot splash, so only one can land.
#1974 keeps the splash and has absorbed this branch's error panel, ?nosplash
guard and reduced-motion handling; this branch keeps the recovery work the
splash reports through — the bounded database opens, the initLanguage timeout
and the boot watchdog.

The placement assertion goes with it: #1974 renders the splash as a sibling
after #app rather than inside it, so that test can no longer hold here. The
remaining cases assert the ids, classes and data-render-state contract #1974
preserved, and need its splash deployed to run green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

APP: White screen after the app has been backgrounded for a while

3 participants