Repository navigation
perf(dashboard): Start the first conversation read from the page head - #2764
Merged
Merged
Conversation
On a cold load of a conversation page, the first detail read waited for the entry module to download and run. An inline head script now starts that exact read (same path, mailbox, and unread page) while the client downloads, and readDashboardResponse takes the response once for the matching path. A mismatch falls back to a normal fetch. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
6 screenshot changes — 6 changed · 0 added · 0 removed Review screenshots in Frameshift |
BYK
approved these changes
Nov 5, 2026
22 tasks done
This branch was successfully deployed
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.
On a cold load of
/conversations/:id, the first detail read started only after the entry module downloaded and ran. In prod (0.280.0) that was 650–1,100ms after navigation start. An inline head script now starts that read while the browser downloads the client, and the client uses its response.How it works
conversationOpenScript(basePath)(newsrc/conversation-open.ts) runs in the shell<head>, only on/conversations/<id>(and notnew), with the base path removed, using the same match asconversationIdFromPath. It builds the exact path of the client's first read:/api/conversations/<id>?unreadPage=true&mailbox=true, or?mailbox=truewhen the start position islatest. It reads the same localStorage key, which now lives inconversation-open.tsso the script andtranscriptReadPosition.tsshare it.readDashboardResponsetakes that response once, and only for the same path and only when it sends no validator. Every other read, including polls that send the detail version, fetches as before. If the path drifts, the result is one extra read, never wrong data. 401 handling, error handling, andrecordDashboardServerVersionrun on the early response too.credentials: "same-origin", the same as the client read. The shell is served only to authenticated viewers.sentry-traceandbaggagemeta values onto the request, so the server span stays in the page request's trace.renderSentryHeadabove the stylesheet for that reason.catch, so it can't trigger the page'sunhandledrejectionerror screen before the client takes it. The client still sees the rejection.I chose this over embedding the detail in the HTML (like #2724) because embedding would hold the HTML response for the detail read, which is p50 216ms for 200s in prod. It would also need its own ETag and mailbox handling on the server.
Timing (Playwright, mock conversations, cold cache, median of 7)
Measured on main at
a2ba54556(with #2757 static assets) before and after this change. Conversationinternal:dashboard-qa. Times are ms from navigation start. "Transcript shown" is the first[data-transcript-seq]row in the DOM.Every run made exactly one detail request. The detail read now finishes about 600ms before the transcript renders, while it competes with the JS downloads for bandwidth. The rest of the cold-open path is client boot.
Tests
opens where the reader left off and reports what they read(e2e/conversations-read-position.spec.ts). It holds all client JS and checks that the detail read still arrives. It then checks that the open makes no second read, for both theunreadand thelateststart positions. This catches a URL drift between the script andreadConversationData./opsbase paths, an encodedlocal:web:id,/conversations/new, nested paths, and a base-path prefix mismatch.Checks
pnpm test:e2e:dashboard: 100/100 passed.typecheckandlintpass. lint-staged passed: file-length, test-architecture and dashboard-style.dashboard-output.test.ts, which also fails on clean main in my sandbox (MISSING_EXPORT nitroIntegrationfrom a hoisted@sentry/[email protected]).Notes
perf/dashboard-static-css) merged, and resolved the conflict in the shell<head>. Inline Tailwind is gone and the script sits before the new stylesheet link.via @BYK.
--
View Session in Sentry