fix(app): 78x faster Home cold loading#36214
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Home page cold-load path by switching session history loading to a single V2 “global” snapshot (with SSE replay) and by keeping per-directory child stores’ heavier queries dormant until a directory is actually opened, while preserving the existing V1 per-directory loader as a fallback.
Changes:
- Load Home sessions via one guarded V2
session.listsnapshot and replaysession.*SSE events over it, with a V1 directory-loader fallback on error. - Avoid bootstrapping per-directory queries (path/providers/LSP/references) for passive directory reads until a real directory access.
- Update related sync plumbing and add focused tests for snapshot parsing/retention and child-store passivity.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/app/src/pages/home.tsx | Switch Home to V2 snapshot query + SSE replay and keep V1 directory loader as fallback. |
| packages/app/src/pages/home-session-snapshot.ts | Add snapshot parsing/retention + SSE event application helpers for Home’s V2 adapter. |
| packages/app/src/pages/home-session-snapshot.test.ts | Add tests for snapshot loading, validation/guarding, retention, and event replay. |
| packages/app/src/context/server-sync.tsx | Gate directory refresh and LSP/reference prefetch behind “queries enabled” checks. |
| packages/app/src/context/global-sync/child-store.ts | Add query enable toggles so passive child creation doesn’t start heavy queries until bootstrapped. |
| packages/app/src/context/global-sync/child-store.test.ts | Add regression test ensuring non-bootstrapping children remain passive until real access. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+366
to
+371
| setSessionEvents( | ||
| produce((draft) => { | ||
| const list = (draft[key] ??= []) | ||
| list.push(event) | ||
| }), | ||
| ) |
Comment on lines
+42
to
+45
| export function retainHomeSessions(sessions: Session[], limit: number, now: number) { | ||
| const grouped = Map.groupBy(sessions, (session) => pathKey(session.directory)) | ||
| return [...grouped.values()].flatMap((items) => trimSessions(items, { limit, permission: {}, now })) | ||
| } |
jerome-benoit
pushed a commit
to jerome-benoit/opencode
that referenced
this pull request
Jul 14, 2026
avion23
pushed a commit
to avion23/opencode
that referenced
this pull request
Jul 17, 2026
avion23
pushed a commit
to avion23/opencode
that referenced
this pull request
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR;
Changelog
Improved
Implementation
Benchmark
Real Beta desktop data: 123 projects, 4,096 session rows, three restored tabs.
Validation