Repository navigation
Fix iOS scroll jumps while loading windowed history - #5022
Merged
ymichael merged 3 commits intoOct 6, 2026
Merged
Conversation
ymichael
force-pushed
the
bb/fix-abrupt-scrolling-jumps-on-ios-thr_pzbsbkuecv
branch
from
October 6, 2026 18:10
b28fd35 to
25d3605
Compare
ymichael
deleted the
bb/fix-abrupt-scrolling-jumps-on-ios-thr_pzbsbkuecv
branch
October 6, 2026 18:23
ymichael
added a commit
that referenced
this pull request
Oct 8, 2026
…5231) ## Human comments ## What was wrong #5022 made the timeline wait to insert a fetched older page until scrolling had been idle for 200 ms, with no touch in progress. The wait applies on every platform. Desktop wheel and trackpad scrolling (including macOS momentum) keeps firing `scroll` events, so the prefetched page stays uncommitted for as long as the reader keeps scrolling. `isLoadingOlderTimelineRows` stays true until the commit, so readers scrolling up now reach the "Loading older messages…" indicator and stall there. Before #5022, rows were inserted as soon as the response arrived, so the 600 px prefetch margin usually hid the load. Only one load can be pending at a time, so the next page also can't prefetch while the reader keeps scrolling. ## What changed Reverts #5022 (9cb923a) in full. One conflict in `useThreadTimelineController.ts` was resolved by keeping #5068's removal of the `useRef` import. This brings back the behaviour #5022 fixed: the iOS momentum-scroll jumps and the stale scroll-anchor yank reported in #4793. ## How you verified - `pnpm exec turbo run typecheck lint --filter=@bb/app` passes: 0 errors, 250 existing warnings. - Timeline, bottom-anchored scroll body, pending-interaction and user-question suites in `apps/app`: 447 tests in 48 files pass. - Not manually scroll-tested in the app. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: qa <qa@x>
This was referenced Oct 15, 2026
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.
Human comments
What was wrong
Loading older messages could move the reader to a different part of the conversation. The saved anchor could outlive its request and apply on an unrelated render. Full-app reproduction also exposed two additional causes: inserting a page during iOS touch/momentum scrolling, and subsequent windowed-row measurements changing the virtual content height. Native Safari swipes on an 80-turn fixture jumped from around Checkpoint 74 to Checkpoint 3 and cascaded through multiple older pages.
What changed
Fetch older history ahead of time, then commit after touch ends and scrolling has been idle for 200 ms. Capture the current visible row immediately before the synchronous page update and pin it in the existing timeline virtualizer. Preserve its screen coordinate while virtual heights settle, for up to 500 ms; new touch, pointer, wheel, keyboard, or explicit navigation immediately releases that hold. Use the height delta fallback when there is no measurable row.
Scope anchors to their update and clear them on failure/cancellation instead of consuming them on unrelated shell renders. Keep request overlap protection and abort a deferred commit when the load control unmounts.
How you verified
pnpm exec turbo run lint typecheck --filter=@bb/apppassed (249 existing lint warnings, no errors);git diff --checkpassed.Rebase and CI follow-up
Rebased onto
origin/mainate3b8caa22c. The Windows app-3 failure came from a test assigningscrollTopwithout dispatching user scroll input while initial bottom-restoration animation frames were still queued. Settle initialization, dispatch wheel and scroll events, and advance fake timers through pagination and subsequent frames so the last-page reading-position assertion is deterministic.Verified 397 tests across 42 files with shuffled seed 4721 and two workers; app lint/typecheck passed (250 existing warnings, no errors). The original test race was reproduced locally before the fixture repair. Production behavior is unchanged by this follow-up.
Fixes #4793