perf: show PR list rows before their checks, and open PRs faster
Summary
The Pull requests view waited on GitHub check data before it showed anything. This PR splits that work so rows and PR headers paint first.
- List rows in ~1 s instead of 3–7 s. Search results render at once; checks, diff stat and branch fill in behind them from a new host procedure.
- PRs open faster. The header paints from the list row immediately, neighbours are prefetched, and the detail read makes its two GitHub calls in parallel.
Also includes (UI follow-ups from review of the above):
- The "210 of 635 pull requests" strip is gone: the count sits on the active state tab, refresh moves next to the panel toggle.
- Loading placeholders: first-load placeholder rows, and shimmer on the branch/check/diff-stat slots while their details load.
- The divider under the search row shows only while the list is scrolled.
- Click-to-copy in the PR header: repo #n → PR link, author → username, age → full date, head/base → branch name.
Measured (real GitHub, 4 repos, default Open view, 634 PRs)
| Before | After | |
|---|---|---|
| List page → rows visible | 2.9–3.5 s (up to 7 s cold) | ~1.0 s |
| List page → checks visible | same as above | +1.5–4.6 s after rows |
| PR detail read (4 runs) | 977–1534 ms | 724–1028 ms |
| Click → PR title visible (dev app) | 0.86–1.58 s | ~0.2 s |
| Click → next PR down, full page (dev app) | same as a cold open | 0.16–0.20 s (prefetched) |
Part 1: List rows before checks
Why
Each page ran gh api search/issues (~1–1.5 s), then a GraphQL statusCheckRollup read for all 30 rows (1.4–1.8 s warm, 5.5 s cold), serially, before answering. Every first load, filter change and next page paid both. Git repo resolution (~30 ms), gh spawn (~30–45 ms) and token lookup (cached) were ruled out. Asking GitHub for check counts instead of contexts is not faster (1.0–2.1 s): the cost is GitHub building the rollup, so the fix is to stop waiting on it.
What / How
workspaceCreation.searchPullRequestsgains optionaldeferChecks. When set, it answers right after the search withchecksDeferred: true.- New
workspaceCreation.getPullRequestRowDetails({ projects: [{ projectId, prNumbers }] })returns checks, diff stat and branch (gh first, Octokit fallback, partial results when one repo fails). The GraphQL helpers moved toshared/pull-request-row-details.ts. - The renderer's list query moved to
usePullRequestsList. When a page comes back deferred it fires the details request and writes the result into that page's cache entry; only the newest request per page writes. A refetch keeps the previous checks on rows until fresh ones land, so icons do not flicker. - Rows carry
detailsPending. Placeholders show only while a page fetch or details request is running; a row left pending (saved cache from a previous session, failed request) hides its check icon rather than showing a false "No checks". - The composer's
@PR mention search also passesdeferChecks; it never displayed checks.
Part 2: Opening a PR
- Instant header: while the detail loads, the skeleton's header slot shows the list row's title, state, author and branch (
usePullRequestListPreviewreads the list cache). - Prefetch: hovering a row for 150 ms (or focusing it) prefetches its detail; after a PR opens, the rows above and below are prefetched after 500 ms.
- Detail read:
readPullRequestDetailstarts therequested_reviewersREST call together with the GraphQL read instead of after it (~0.3 s). A missing PR still reads asNOT_FOUND.
What remains: a cold open still waits ~0.8–1.5 s for the full detail. A header-only GraphQL read takes ~330 ms vs ~0.8–1.06 s for the full one, so a parallel quick read is the next lever (not in this PR).
Manual QA Checklist
Verified in a dev build over CDP, on real data:
- List rows render before checks; branch/check/diff-stat slots shimmer, then fill (switched to All and Merged to force cold queries)
- First load of a new query shows placeholder rows
- Count shows on the active tab ("Open 635", "All 7,764", "Merged 5,131"); refresh sits in the top row and spins while fetching; the strip is gone
- Divider under search is transparent at the top, visible once scrolled, gone again at the top
- Cold click shows the PR title in ~0.2 s; the PR below an open one opens fully in ~0.17–0.2 s
- Each header part copies the expected value and shows "Copied" (clipboard write intercepted in-page)
- App restart with a saved list cache: rows repopulate, nothing left shimmering
Not verified:
- Packaged build
- Against an older host-service (no older host to hand; relies on zod stripping the unknown
deferChecksand the client gating onchecksDeferred) - The cloud-identity detail path (machine with no local GitHub login)
- Light theme and very narrow list widths
Testing
- Typecheck:
apps/desktop(tsc --noEmit),packages/host-service,packages/shared bunx biome checkon all changed filesbun test— desktop pull-requests + PR pane (84), host-serviceworkspace-creation-github.integration(47), sharedpull-request-detail/pull-request-github(9),packages/i18n(169)bun run check:i18n— two new strings ("Copy username", "Copy branch name") translated in all 17 locales; two unused strings removed- New tests: deferred search makes only the search call; row details read every check page over gh; Octokit fallback; detail read starts requested reviewers alongside the main read (fails on the old code); row placeholders only while loading (fails on the old code); list-cache preview lookup; row-detail merge by project + number
Compatibility
Host-service changes are additive (new optional input, new optional output field, new procedure), per packages/trpc/AGENTS.md:
- New desktop → old host: the host ignores
deferChecksand returns enriched rows with nochecksDeferred, so the client never callsgetPullRequestRowDetails. Works as before, without the speedup. - Old desktop → new host: no
deferCheckssent, same response as today. - No
MIN_HOST_SERVICE_VERSIONbump needed.
Risks / Rollout
- GitHub request budget: each opened PR now also reads its two neighbours, and hovered rows are read. One detail read costs 1 GraphQL point plus 1 REST call; reviewing 50 PRs/hour is roughly 150–200 of each against 5,000/hour budgets shared with
gh, agents and host sweeps. - Persisted cache size:
pull-request-detailqueries are persisted, so prefetched details are also saved and re-serialized by the throttled persister. Not measured. - List complexity: checks now arrive via a follow-up request that writes into the page cache, with out-of-order replies dropped. The merge logic is unit tested; the request ordering is not.
Rollback
Revert the PR. Because the host changes are additive and the client gates on checksDeferred, reverting either side alone also degrades cleanly to today's behaviour.
How to review
packages/host-service/.../search-pull-requests.tsandget-pull-request-row-details.ts(the contract)PullRequestsView/hooks/usePullRequestsList(deferred details, carry-over, in-flight tracking)PullRequestRow,PullRequestsContent,PullRequestsTopBar(placeholders, count, refresh)- Detail:
usePullRequestListPreview,PullRequestDetailSkeleton,PullRequestItemHeader+PullRequestCopyText
Summary by cubic
The Pull requests view no longer waits on GitHub check data before showing rows, and opening a PR paints its header from the list row immediately instead of waiting for the full detail read.
Behavior
- List rows render in ~1s instead of 3–7s; checks, diff stat, and branch fill in behind them via a new
getPullRequestRowDetailshost procedure, and stale replies (including from unmounted lists) can never overwrite newer data. - Opening a PR shows its title, state, author, and branch in ~0.2s — even before the list finishes loading — starts the
requested_reviewersREST call in parallel with the GraphQL read, and prefetches the rows above and below. - The count moved from the "N of M pull requests" strip onto the active state tab, rows shimmer while check details load, and header values copy on click (tooltips show the full value; failed copies report "Copy failed").
- Hovering a row for 300ms (or focusing it) prefetches its detail — one read at a time, and a hover landing mid-prefetch is queued as the next read so the row the pointer rests on still opens warm; the rows above and below an open PR are prefetched after 500ms, and a refetch keeps previous checks visible but hides them if no fresh details arrive.
Risks and compatibility
- Each opened PR reads two neighbors, and hovered rows add one GraphQL point plus one REST call, so GitHub request usage grows with navigation.
- Host changes are additive — older hosts ignore
deferChecksand behave as before without the speedup.
Summary by CodeRabbit
-
New Features
- Pull-request lists show summary details first, then fill in checks, branches, and change counts as they become available.
- Loading placeholders appear while pull-request details load. Hovering over or focusing a row can prepare its details in advance.
- Pull-request detail loading screens can display available pull-request information.
- Copy repository details, usernames, and branch names from pull-request headers, with feedback on whether copying succeeds.
- Refresh pull-request lists where supported, with loading feedback and result counts.
-
Bug Fixes
- Improved pull-request detail loading when requested reviewer information is unavailable.