Explicit bootstrap gate for persisted data preload
- Dominant language
- TypeScript
- Stars
- 481
- Forks
- 108
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 7
Description
## Parent
#1820
## What to build
Replace the top-level `await` that currently preloads persisted data into Jotai atoms with an explicit bootstrap gate. Today persistence preloading happens via a top-level await in the storage-atoms module, which blocks the entire JS module graph: if IndexedDB is slow or throws during preload, React never mounts and the user sees a blank page with no loading state and no error recourse.
Introduce an explicit `preloadAll()` that the app entry point awaits, wrapped in a loading screen and an error boundary. This decouples "data is loading" from "the module graph is blocked," and gives a real failure path when IndexedDB preload fails.
In-memory reads stay synchronous after preload; no consumer call sites change. This slice is independent of the merge work and can proceed in parallel with the reconciliation slices.
## Acceptance criteria
- [ ] The top-level await in the storage-atoms module is replaced by an explicit `preloadAll()` awaited at the app entry point
- [ ] A loading state renders while persisted data preloads
- [ ] A preload failure (e.g. IndexedDB throws) renders an error boundary instead of a blank page
- [ ] Atoms are fully populated before the app renders; no consumer call sites changed
- [ ] Tests cover the success path and the preload-failure path
## Blocked by
- #1830
> [!IMPORTANT]
> Internal only — this issue is maintained by the core team and is not accepting external contributions.
Contributor guide
Assessment
This issue has not been assessed yet.