Skip to content

Restore #6405 extent-changed scroll pinning dropped in 0.48 sync - #366

Merged
albrand merged 5 commits into
oursfrom
fix/restore-6405-extent-changed
Oct 29, 2026
Merged

albrand merged 5 commits into
oursfrom
fix/restore-6405-extent-changed

Conversation

@albrand

@albrand albrand commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Sync merge #360 kept most of upstream get-bb#6405 but dropped the no-input extentChanged branch in ScrollPositionKeeper.handleScroll. On our fork, attached-bottom scroll events often bypass handleScroll and defer to reconcile, so a clamp scroll after the scroll extent changes (for example when iOS grows the scroller clientHeight and maxScrollTop drops) could be treated like navigation and unpinned the timeline.

What changed

  • scroll-position-keeper.ts: Restored upstream’s cached-maxScrollTop vs refreshExtent comparison for no-input scrolls in handleScroll, split from the existing followsUnexplainedScroll branch so extent/floor layout scrolls still re-attach without treating them as user navigation. Added the same extent/floor block on the fork’s attached-bottom onScroll path (upstream calls handleScroll for every scroll; we only restore parity on the bottom defer path).
  • scroll-position-keeper.test.ts: Guard test that grows the fake viewport by 225px, takes a clamp, fires a no-input scroll before ResizeObserver flush, and expects the reader to stay attached at the new end.

Diff vs upstream c6c23be71f: Upstream routes all scrolls through handleScroll; the extent clause lives only there. This PR keeps fork-only input deferral, shrink-clamp, window-find, pointer/touch attach, and bottom onScroll rAF reconcile, and duplicates the extent/floor clause on that bottom path.

Diff vs ours before this PR: Replaces the single (isFloorStale() || !followsUnexplainedScroll()) early return with extent-aware layout handling plus the separate unexplained-scroll branch unchanged in intent.

RED note: On ours (9e011235), the new test still passes without the restored clause (~/projects/bb-fork-6405-logs/red-scroll-keeper.log, exit 0). RED not reproducible: the floor and deferred reconcile cover every path this harness produces; the clause is kept for upstream parity and the real iOS client-height path.

No issue: issues disabled

How you verified

  • pnpm exec turbo run test --filter=@bb/app -- scroll-position-keeper.test.ts -t "225 px viewport" (GREEN: ~/projects/bb-fork-6405-logs/green-scroll-keeper.log)
  • pnpm exec turbo run test --filter=@bb/app -- scroll-position-keeper timeline (~/projects/bb-fork-6405-logs/green-focused-tests.log)
  • pnpm exec turbo run generate --filter=@bb/server && pnpm exec turbo run typecheck lint test --filter=@bb/app — typecheck and lint passed; one unrelated terminal focus replay test failed on hsrpc (~/projects/bb-fork-6405-logs/green-full-app.log)

AGENT GENERATED


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

bb upstream sync and others added 5 commits October 29, 2026 12:52
Reintroduce the no-input extent comparison dropped during the 0.48 sync merge, including the fork bottom-scroll path that defers to reconcile instead of handleScroll.

Co-authored-by: Cursor <[email protected]>
Guard against re-pinning during input when the viewport clamps, and against a second deferred reconcile after bottom extent layout scrolls.

Co-authored-by: Cursor <[email protected]>
Reset the reconcile spy after setup so the regression fails when onScroll schedules a second reconcile pass.

Co-authored-by: Cursor <[email protected]>
@albrand
albrand merged commit 09eb3a3 into ours Oct 29, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant