perf(web): load the bootstrap and the first issue page together - #243
Conversation
dehydratedWorkspace waited for the whole bootstrap before it started the first issue page, because it read the active team id off the finished payload. The issue list is the heaviest query in the dehydrated state and it sat behind six that it does not depend on. Only the team list decides which team is active, so split that out. bootstrapTeams resolves teams and the active team, bootstrapPayloadFor builds the rest from that, and bootstrapPayload composes the two so the route handler is unchanged. dehydratedWorkspace then resolves the team once and runs the rest of the bootstrap and the issue page together. No query is repeated: the team list is fetched once and handed to both.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 5 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follow-up to #242, on the same hard-load path.
The problem
dehydratedWorkspacewaited for the entire bootstrap payload before it started fetching the first issue page, because it readactiveTeamIdoff the finished payload:The issue list is the heaviest query in the dehydrated state, and it sat behind six queries it does not depend on.
The change
Only the team list decides which team is active, so that is the one thing the issue page actually waits on.
bootstrapTeamsresolves the teams and the active team.bootstrapPayloadForbuilds the rest from an already-resolved team list.bootstrapPayloadcomposes the two, so/api/bootstrapis unchanged.dehydratedWorkspacenow resolves the team once and runs the rest of the bootstrap alongside the issue page.No query is repeated. The team list is fetched once and handed to both halves, so this removes a round trip from the critical path without adding one anywhere else.
Tests
Three new tests in
apps/web/tests/lib/query/prefetch.test.ts. They hold each loader open and assert what has started, so re-serialising fails them.Verified by mutation. Against the previous sequential version all three fail, the direct one immediately:
Full web suite on this branch: 1583 pass, 0 fail.
Greptile Summary
The PR shortens the hard-load critical path by resolving the active team first, then loading the remaining bootstrap data and initial issue page concurrently.
/api/bootstrapcomposition.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Sequence Diagram
sequenceDiagram participant W as dehydratedWorkspace participant T as bootstrapTeams participant B as bootstrapPayloadFor participant I as serverIssuePage participant Q as QueryClient W->>T: Resolve teams and active team T-->>W: BootstrapTeams par Remaining bootstrap W->>B: Build payload from resolved teams B-->>W: Bootstrap payload and Initial issue page W->>I: Fetch active team's issues I-->>W: Issue page end W->>Q: Cache bootstrap and issue page W-->>W: Dehydrate query stateReviews (2): Last reviewed commit: "Merge main into perf/bootstrap-parallel" | Re-trigger Greptile