Repository navigation
fix(mobile): keep the chat where the reader scrolled to - #28413
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to
|
RN Web reports no drag events, so the page never stopped following a live turn. Native lost its place when older history loaded.
A busy turn outran the 40-message window and dropped the row being read.
RN Web's list draws rows by index, so rows added at the front replaced the ones on screen.
31b0808 to
e468385
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 Major · Prevent repeated history loads during one near-top gesture. · MobileNativeChatView.tsx:278
mobile/src/session/MobileNativeChatView.tsx:278
🎯 Functional Correctness | 🟠 Major | ⚡ Quick winPrevent repeated history loads during one near-top gesture.
readerIsScrolling()remains true fromonScrollBeginDraguntil the gesture ends. WhenloadingEarlierbecomes false, another near-toponScrollcan callloadEarlier()again. The callback only blocks concurrent requests. It does not require new upward movement or a changed row count. Add a per-page trigger guard so native anchoring or continued scroll events at the same position cannot load successive pages.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f967f15f-f2c4-446f-ab6e-8ce144ed4c2a
📥 Commits
Reviewing files that changed from the base of the PR and between 31b0808bf68a107b9059a293581d5388dafc69a8 and e468385.
📒 Files selected for processing: 5
mobile/src/session/MobileNativeChatScrollHold.test.tsxmobile/src/session/MobileNativeChatScrollHold.tsxmobile/src/session/MobileNativeChatView.tsxmobile/src/session/use-mobile-native-chat-page-history.test.tsxmobile/src/session/use-mobile-native-chat-page-history.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Total height also grows when live output lands below the reader in the same update.
Resolve MobileNativeChatView against #28413 page history: route the row renderer through history.renderListRow and keep strictMode.
* fix(mobile): keep the chat where the reader scrolled to RN Web reports no drag events, so the page never stopped following a live turn. Native lost its place when older history loaded. * fix(mobile): keep chat history the phone already shows A busy turn outran the 40-message window and dropped the row being read. * fix(mobile): keep the page's place when history loads RN Web's list draws rows by index, so rows added at the front replaced the ones on screen. * fix(mobile): hold the page's place by a row on screen Total height also grows when live output lands below the reader in the same update. --------- Co-authored-by: Brennan Benson <[email protected]> (cherry picked from commit 12ba3bc)
* fix(mobile): keep the chat where the reader scrolled to RN Web reports no drag events, so the page never stopped following a live turn. Native lost its place when older history loaded. * fix(mobile): keep chat history the phone already shows A busy turn outran the 40-message window and dropped the row being read. * fix(mobile): keep the page's place when history loads RN Web's list draws rows by index, so rows added at the front replaced the ones on screen. * fix(mobile): hold the page's place by a row on screen Total height also grows when live output lands below the reader in the same update. --------- Co-authored-by: Brennan Benson <[email protected]> (cherry picked from commit 12ba3bc) (cherry picked from commit 78cbb87)
ELI5
On the phone, reading back through a chat while the agent was still working was close to impossible. In builds that draw the chat as a web page, every new line of output pulled you back to the bottom. The message you had stopped on could also vanish, and scrolling up to older messages could throw you a long way back. Now the chat stays where you put it.
What Changed
Three things a reader ran into, and what happens now.
Pulled back to the bottom, in over-the-air builds. Before, you scrolled up while the agent worked and the next line of output dragged you back to the newest message. During a live turn you could not get more than a message or two away. Now the view stays where you scrolled to and the "Scroll to latest" arrow appears. Scrolling back down to the end starts following again. A finished chat with long replies did the same with no output arriving: scrolling up made the list draw rows it had not drawn yet, the chat's height changed, and the page took that for new content and went back to the bottom.
The message you are reading disappears, in every build. Before, the phone kept only the newest 40 messages while a turn ran. Each new one pushed the oldest out, so after a busy couple of minutes the message on screen was gone and something else was in its place. Now the phone keeps what it has shown, up to the 2,000 message ceiling it already had for scrolling back through history.
Thrown backwards when older messages load, in every build. Before, scrolling near the top loaded older messages above you, and the screen stayed at the top of the list, which was now 60 messages earlier. Still at the top, it loaded again. One swipe could move you 180 messages back. Now older messages load above you and the message you were on stays where it was.
How it works:
maintainVisibleContentPosition). It anchors below the "Load earlier messages" row, because that row stays at the top of the list and would otherwise be the thing held in place.Why
Scrolling up to read while an agent works is the most common thing to do in a long chat, and on current builds it did not work. Android 0.0.55 and the two iOS release runs of Oct 12 were built with the over-the-air shell, and desktop 1.4.225 ships the page they draw.
Choices worth explaining:
disableVirtualizationsetting draws from the first row to the last one already drawn, not every row. Restoring the scroll position alone was tried first and landed on the wrong message, because the rows on screen had been replaced. The cost is that history loaded by scrolling back stays drawn until the chat is left.Known limits:
Follow-up:
Linked Issue
Fixes #11638
Fixes #22272
Visual Proof
The chat as an over-the-air build draws it, on an Android emulator, with a made-up chat and a new message arriving every 0.6 seconds. In both clips the reader scrolls up about three seconds in.
Before, with the page built from main. The view is pulled back to the newest message within a second and stays glued there.
orca-scroll-before.mp4
After, with the page built from this branch. The view stays where it was scrolled to and the arrow appears. A tap on the arrow goes to the newest message and following resumes.
orca-scroll-after.mp4
Loading older history, and native builds, are not recorded here.
Testing
Run on an Android emulator. Not run on iOS in either kind of build, and not against a desktop built from this branch.
What was run:
Shipped page. Android 0.0.55 paired to desktop 1.4.225, in a chat with a turn in progress. Scrolled up and the view stayed for four seconds with no output, then was pulled to the bottom when the next rows arrived. Six flings upward left the view two messages from the end.
Fixed page. The page was built from this branch with
pnpm run build:mobile-weband served to the same 0.0.55 app by a local stand-in for the desktop, which replays a recorded chat through the desktop's own transcript reader and watcher. Scrolled up and played 60 lines of live output: the screen was identical and the arrow was showing. Scrolled back to the end and played 60 more: the view followed.Native build. A debug build of the phone app from this branch, against the same stand-in. With 0.0.55 falling back to native screens, one slow swipe at the top loaded three pages and left the view at the top of them, and about 65 live messages replaced the screen of a reader who had scrolled up. With the debug build, the same swipe left the same text on screen and the same live output changed nothing. This run predates the page-side changes. Tests cover that path since.
A finished chat on the page. A made-up chat of 20 very long replies, with nothing arriving. Before, twelve swipes up ended at the very bottom of the last reply. After, the same swipes ended a full reply higher with the arrow showing.
Older history on the page. A made-up chat of 300 messages on the same setup. Before, one reach of the top loaded four or five pages and left the view at the top of them. After, one page loaded per reach and the same text stayed on screen with the loaded messages directly above it. Done twice in a row.
To try the page on a phone, which was not done here:
pnpm run build:mobile-web, thenpnpm dev. The dev desktop listens on 6769, beside an installed Orca.Tests cover, on the page: a move up stops following and a return to the end resumes it, the chat's own scroll landing short of a grown end is not taken for the reader, a resized viewport pins to the measured end, and history loads on the reader's upward scroll only, the list keeps its rows when history loads above it and gets every row back once its first row is gone, and the view moves by what landed above the reader, also when live output lands below in the same update. In native builds: a drag that loads history from a short chat resumes following where it ends, history does not load from a scroll the reader did not make, and the anchor sits below the header. In the data layer: live output past the first window drops nothing, a page requested before that output still lands ahead of it, and a growing-tail read asks for what the phone holds plus one page.
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)