feat(language): implement timeout handling in initLanguage to prevent splash screen stalling - #1972
Conversation
3e71c89 to
5260324
Compare
johan-bell
left a comment
There was a problem hiding this comment.
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 10sDB_OPEN_TIMEOUT_MSwrapsdb.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 (theblockedhandler at :906 already detects it).app/src/main.ts:43— the 45s watchdog only shows visible UI beforeapp.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 newLANGUAGE_BOOT_TIMEOUT_MSblock 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.tstests globalConfig (existing initLanguage tests live inglobalConfig.spec.ts) and burns the real 5s timeout twice — fake timers would keep the suite fast.
|
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. |
… splash screen stalling
5260324 to
69eb7b7
Compare
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>
No description provided.