Skip to content

fix(dashboard): Stop transcript jumps while scrolling up on mobile - #2634

Merged
BYK merged 1 commit into
mainfrom
fix/dashboard-transcript-row-size
Nov 3, 2026
Merged

BYK merged 1 commit into
mainfrom
fix/dashboard-transcript-row-size

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Scrolling up through a loaded Conversation on a phone still jumps after #2511.

Cause. On narrow screens, transcript rows used content-visibility: auto with a 12rem size estimate. A row that has not rendered yet has that estimated size. When the reader scrolls near it, it renders and gets its real size. Above the reader, each change moves the content, so the pinning hook corrects scrollTop while the reader is still scrolling. On phones, a scroll write during a touch scroll shows as a jump.

I measured this in Chromium at the mobile viewport, with 200 events of mixed length and one wheel scroll up through them:

Scroll corrections
main ~50 (−99 px to +655 px each)
This PR 1 (the earlier page insert)

Fix. Transcript rows lay out at their real size. The scroll anchor now corrects the position only when the layout really changes above the reader, such as an earlier page or a late image. The sidebar list keeps content-visibility, because its rows have a fixed height.

The -mx-2 px-2 on rows kept control outlines inside the paint containment. Without containment it does nothing, so it is gone.

Trade-off. Off-screen rows now cost layout on phones again. #2568 bounds this with a capped window and a virtual list.

The mobile earlier-history journey now scrolls up through the loaded rows and checks that the transcript makes no scroll corrections. It fails on main with 11 corrections.

Refs #2568

via @BYK.

--

View Session in Sentry

Transcript rows on phones used content-visibility: auto with a 12rem
size estimate. Each row that had not rendered yet changed size when the
reader scrolled near it, so the pinning hook corrected the scroll position
while the reader scrolled. Lay rows out at their real size instead.

Co-Authored-By: BYK <[email protected]>
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 3, 2026 10:14pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

18 screenshot changes — 18 changed · 0 added · 0 removed

Review screenshots in Frameshift

Automation Page · Desktop
Automation Page · Desktop
Changed
Automation Run Details · Desktop
Automation Run Details · Desktop
Changed
Automation Run Details Light · Desktop
Automation Run Details Light · Desktop
Changed
Conversation Attachment · Mobile
Conversation Attachment · Mobile
Changed
Conversation Child Agent Drawer · Mobile
Conversation Child Agent Drawer · Mobile
Changed
Conversation Child Agent Page · Mobile
Conversation Child Agent Page · Mobile
Changed
Show 12 more changed screenshots
Conversation Child Agents · Mobile
Conversation Child Agents · Mobile
Changed
Conversation Detail · Mobile
Conversation Detail · Mobile
Changed
Conversation Detail Focused · Mobile
Conversation Detail Focused · Mobile
Changed
Conversation Details Sheet · Mobile
Conversation Details Sheet · Mobile
Changed
Conversation Details Sheet Light · Mobile
Conversation Details Sheet Light · Mobile
Changed
Conversation Fork Dialog · Mobile
Conversation Fork Dialog · Mobile
Changed
Conversation Fork Links · Mobile
Conversation Fork Links · Mobile
Changed
Conversation Review Item Card · Mobile
Conversation Review Item Card · Mobile
Changed
Conversation Review Item Dismissed · Mobile
Conversation Review Item Dismissed · Mobile
Changed
Conversation Unread Marker · Mobile
Conversation Unread Marker · Mobile
Changed
Review Desk Item · Mobile
Review Desk Item · Mobile
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed

@BYK
BYK merged commit ec3f4cd into main Nov 3, 2026
62 of 63 checks passed
@BYK
BYK deleted the fix/dashboard-transcript-row-size branch November 3, 2026 22:41
thomasjiangcy pushed a commit that referenced this pull request Nov 4, 2026
Main CI on 38c8693 (#2625) fails `check / types`, `test / junior
unit`, and `test / dashboard e2e`.

**Types and unit.** #2625 added `web-batch-messages.test.ts` with
`webActorFromEmail`. #2630 removed it. The test now uses
`webActorFromUser(testViewer(...))`, the same fix as c1e36af in #2631.

**Dashboard e2e.** `conversations-mobile.spec.ts` "keeps the message in
view while earlier history and late content load" is flaky. It is not a
regression from #2622 or #2625:

- Main CI: failed on f23838b (#2622, which only changes
`ReviewItemContext.tsx`) and 38c8693. Passed only on retry on
38597fb. Each of these failed at line 752, the last step (spacer above
the reader).
- #2634 added `scrollIntoViewIfNeeded()` right before that step. The
scroll event fires on the next frame. When the test appends the spacer
first, the transcript's scroll handler records the reader's place from
the layout that already has the spacer. The resize correction then sees
no shift. Local logs showed this order in every failure and the opposite
order in every pass.
- The test now waits one frame after each scroll so the scroll event
runs first. Assertions are unchanged. Locally the last step went from 6
failures in 16 runs to 0 in 160.

**Still open.** Under 4 parallel workers, 7 of the 160 local runs failed
one step earlier (after the earlier page loads). I did not measure that
step on main without this change. In the one failure I logged, the
correction ran twice: `scrollTop` moved by exactly 2× the shift. That
points to a product race in `transcriptBottomPinning.ts`, not a test
race. This PR does not fix it. I have not seen it fail in CI.

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A586024895340456299c9cfbe04e88e91 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A586024895340456299c9cfbe04e88e91)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A586024895340456299c9cfbe04e88e91/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <[email protected]>
BYK added a commit that referenced this pull request Nov 4, 2026
First step of #2568: *cap how far toward the present the first load
goes*.

Today a reader whose read position is older than the latest 500 events
opens at the latest page. The "New" marker shows at the top of the
loaded rows, not at the first unread row, and the reader has to scroll
back through every page to get there.

| Opens at the read position | Newer page loads on scroll |
| --- | --- |
| <img
src="https://junior-prod.sentry.dev/public/artifacts/59cb7aa5-8ddd-4b00-8ab2-2a5879ba9466.png"
width="300"> | <img
src="https://junior-prod.sentry.dev/public/artifacts/4055c884-2a43-4285-bd74-a2ed55b164f2.png"
width="300"> |

**API**

- `GET /api/conversations/:id/events` takes `after=<cursor>` and
`around=<cursor>` as well as `before=<cursor>`. An `after` page holds
the earliest events after the cursor. An `around` page ends half of its
events with the cursor event, and the rest follow it. Both have a
`nextCursor` when newer events follow. An `around` page also has a
`previousCursor` when older events come before it.
- Conversation detail has an `unreadCursor` when the viewer's read
position is older than `events`. It is a normal signed cursor at the
read position. It comes from the read position that detail already
reads, so detail runs no extra query.
- `GET /api/conversations/:id?unreadPage=true` also returns the `around`
page of `unreadCursor` as `unreadPage`. Without the flag, or without a
cursor, detail reads no extra page. If that page read fails, detail
still returns without it.

**Dashboard** (new `transcriptUnreadHistory.ts`)

- When the fetched detail has an `unreadCursor`, and the reader opens at
unread (the default), the transcript starts with the page around the
read position, so the last read events show above the marker. It opens
at the "New" marker as usual.
- The app shell owns the open Conversation's data and passes it to the
page. It fetches once at the start of each visit, also when the cached
copy is fresh, and only that fetch asks for `unreadPage`. Polls do not
ask. If detail comes without the page, an `around` request reads it.
- A cached transcript stays on screen, with no marker, no earlier-page
loads, and no read reports, until this visit's fetch tells where to open
and the unread page is there.
- Newer pages load when the reader scrolls near the end, the same way as
earlier pages. The latest page joins only after they reach it, so the
transcript has no gap. Until then, the transcript ends with "Show newer
messages", no thinking row, and sends wait in the queue.
- Jump to latest, a send, or the mobile keyboard skips the newer pages.
The transcript shows the latest page at once, and earlier pages load
above it. A poll that skips past the newer pages does the same, so the
transcript never drops the skipped events.
- Earlier pages load on scroll from the read position, not from the
latest page.
- Two loads of the same page share one request. Each visit starts again
from the page around the read position, so newer pages from an earlier
visit do not come back.
- A linked event, Turn, or memory outside the loaded pages loads one
page at a time toward it.
- Without a cursor, with the "Latest message" preference, or when the
first page fails, nothing changes.

**Server cost**

- Detail polls: no new query. The read position now reads in parallel
with the other detail reads, not after them.
- Open far behind: one request, also on a direct load. Detail reads the
`around` page (two half pages in parallel) next to its mention lookup.
That is one round trip, one conversation read, and one access read fewer
than a separate `around` request.
- Each newer page costs the same as an earlier page, and only loads when
the reader reaches it. A reader who opens far behind and does not scroll
reads one page more than today, in the same request. A reader who reads
to the end reads the same pages as today, but from the other direction.
Jump to latest reads no newer pages.

The read-position journeys moved to
`conversations-read-position.spec.ts`, because the mobile spec went over
the file length limit. The far-behind journey loads the page directly,
120 events behind the latest page. The page opens at the first unread
row with the read events above it. Only the first detail request asks
for the unread page, and it makes no `/events` request. No newer page
loads before the reader scrolls, and the latest page waits until the
newer pages reach it. The pages before the latest page are never read. A
poll that skips more than a page opens the latest page without a gap.
The cached-reopen journey checks that the reopen fetch asks for the
unread page. The other read-position journeys get no `unreadPage`, so
they cover the separate `around` request.

Detail mocks in the other e2e specs now match the detail URL with a
query string. The archive queries moved to `conversationArchive.ts`, so
`queries.ts` stays under the file length limit.

**Still open in #2568**

- Scrolling to the end still mounts every row from the read position to
the latest. The next step caps the mounted range and adds a virtual
list. TanStack `maxPages` on these queries is a natural fit. This also
covers the layout cost that #2634 adds back on phones.
- Linked events, Turns, and memories should open from the server with
the page around them, not by a page-by-page search. That needs no new
table: see the review thread.

Refs #2568

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3A735c6e48f79c0c925da15893 -->

--

[View Session in
Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A735c6e48f79c0c925da15893/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <[email protected]>
Co-authored-by: BYK <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — b3d588da Deployed Nov 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant