Repository navigation
fix(chat): let the list scroll to the end that is drawn, so a reopened chat lands at its end - #2720
Conversation
… the one it measured A reopened chat could end short of its end and take the reader for one who scrolled away (chat-virtual-browser-qa.ts:81 timing out on #2621 and #2644, Jump to latest showing). Caught on a reload: while its own scroll to the end was on its way, LegendList clamped the view to the end it had measured so far (the footer and some rows not measured yet, 54 px short), a move up with no input that ChatView reads as the reader leaving. The LegendList patch now never clamps a scroll below the end the browser allows, and a scroll to the end adds what the list has not measured yet. chat-virtual-browser-qa.ts gains the case: a footer margin the list never measures makes its end lag by more than the layout allowance; the chat must still land at the end, following. Co-authored-by: sisyphus-dev-ai <[email protected]>
… height The scroller's scrollHeight includes room the list pads past its end for a frame and the selection hold's min-height, so the clamp and scrollToEnd could aim into it: reply-comments-demo-regression.ts drag selections landed on other words in 2 of 7 runs. The end is now the bottom of the list content's children (rows as drawn, a header or footer not measured yet). reply-comments 10/10, as on main. The chat-virtual case makes the list's end lag with a box drawn after the footer (as an unmeasured footer does) instead of a margin, which is not drawn content. Changelog fragment added. Co-authored-by: sisyphus-dev-ai <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
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. |
Review (Codex, reproduced): rows sit inside a wrapper as tall as the list's measured total, so a row drawn taller than measured reaches past it without growing it; the drawn end now counts the rows inside it too. Review (omo): scrollToEnd's unmeasured part no longer clamps the measured end at zero first, which undercounted it when the measured content is shorter than the view. The chat-virtual case also makes the list's end lag past the rows' wrapper (fails on the previous head), and waits until the view is at the end for three frames instead of a fixed frame count. Co-authored-by: sisyphus-dev-ai <[email protected]>
|
Review round on 735a121 (omo: CLEAR; Codex gpt-6.1-terra xhigh: REQUEST_CHANGES, no HIGH). Fixed in 74b4389:
Validation on 74b4389: CodeRabbit: see its status on this PR; the omo and Codex reviews stand in if it was skipped or rate-limited. |
|
Reviews at 74b4389: omo CLEAR; Codex (gpt-6.1-terra xhigh) REQUEST_CHANGES on one test-only MEDIUM, no HIGH. Per the one-more-round rule this PR stops here; remaining notes, none blocking:
CodeRabbit skipped this PR; the omo and Codex reviews stand in. |
|
Merge note: CodeRabbit skipped this head; merged on the omo review (CLEAR at 74b4389), Codex Terra (one unreproduced test-timing MEDIUM, noted above), a deterministic QA case that fails on main, and green required checks. |
Change
scripts/chat-virtual-browser-qa.ts:81(settleBottomafterpage.reload()) timed out intermittently on PR runners (#2621's rerun, twice in a row; #2644): the reopened chat ended about 54 px short of its end, and CI's failure screenshot shows Jump to latest. The test was right: a reopened chat took the reader for one who had scrolled away, with no input.Caught with a debug build that logs every follow and scroll decision (it failed the first reload in 4 of 8 runs under load):
followMeasuredputs the view at the real end:max(measured 120061, scrollHeight 120115) - 900 = 119215.contentLength(120061) - clientHeight. LegendList's own scroll to the end is still on its way, and while one is (state.scrollingTo), itsonScrollclamps any position past the end it has measured so far back to that end (clampScrollOffset). Its measure lags the transcript by 54 px there (the footer and some rows not measured yet).ChatView.onScrollsees a move up with no input, 54 px from the end (more than the 48 px layout allowance) over a transcript that did not shrink, and concludes the reader left the end:stick=false paging=true, Jump to latest. Nothing follows again. When the lag is under the allowance, the chat instead stays "following" short of the end, with nothing left to correct it (the local variant).LegendList's end on the web can only lag what the browser shows (it measures what it renders, a frame or more late), so the fix is in the LegendList patch this repo already keeps (
patches/@legendapp%[email protected], two hunks, plus a helper):min-heightunder the content (the selection hold's room, fix(chat): keep the words under a selection held through a slow fold #2684). An earlier version used the scroller'sscrollHeight, which includes that room, and madereply-comments-demo-regression.tsdrag selections land on other words in 2 of 7 runs.clampScrollOffsetnever clamps below that drawn end. This is what pulled the view up in the captured failure.scrollToEndadds what the list has not measured yet (the drawn end past its measured one) to its end offset, so its own target is the real end instead of re-landing short.When the list's measure matches what is drawn (settled), both changes are no-ops; a larger measure (rows estimated taller than drawn) keeps the list's own value. No app code changes.
The test:
chat-virtual-browser-qa.tsgains the case right after the reload step that timed out. A 100 px box drawn after the footer inside the list's content, which the list never measures, makes its end lag the transcript's by more than the layout allowance (as an unmeasured footer and rows did in the captured failure), and a view a pixel shorter makes the chat follow its end and the list scroll to its own. The chat must end at the end, still following, with no Jump to latest. On main it ends 61 px short in every frame from the second on ({"gaps":[101,100,61,61,...]}); with this change it ends at 0.Validation
chat-virtual-browser-qa.tswith the new case: origin/main (with fix(chat): keep the words under a selection held through a slow fold #2684) fails 2/2 at the new case (61 px short in every frame from the second on); this branch passes 4/4 (all four width/theme passes). The case lags the list's end twice: a box after the footer, and a box past the rows' wrapper (a row drawn taller than measured), which the review head 735a121 failed 2/2.reply-comments-demo-regression.ts(drag selections, which the earlierscrollHeightversion broke): 10/10 on main; on this branch 10/10, and 6/6 again on the final head 74b4389 (with turn-end 4/4, chat-history and local-send-follow passing,check fastok).chat-selection-turn-end-demo-regression.ts6/6 on this branch.chat-history-browser-qa.ts,chat-local-send-follow-demo-regression.ts,chat-quote-selection-end-regression.ts,chat-scroll-padding-regression.ts,chat-select-quote-demo-regression.ts,chat-selection-copy-regression.ts,chat-working-line-demo-regression.ts,chat-no-rewind-demo-regression.ts,reply-comments-demo-regression.ts,chat-gjc-streaming-browser-qa.ts. Runs were capped at 4 at a time with one shared demo build per variant.bun installfrom an empty cache and reproduces the tested file byte for byte; fix(chat): keep the words under a selection held through a slow fold #2684'sreact.d.tshunk is kept;bun.lockis unchanged.bun run check fast.bun run check full, the Mac and Windows lanes (no platform code changed).Changelog:
changelog.d/chat-reopen-lands-at-end.md(Fixed).