Skip to content

Hold at-bottom changes until the timeline has seen a viewport resize - #35727

Closed
langleyd wants to merge 1 commit into
developfrom
fix/timeline-shrink-at-bottom-flake
Closed

langleyd wants to merge 1 commit into
developfrom
fix/timeline-shrink-at-bottom-flake

Conversation

@langleyd

@langleyd langleyd commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Fixes #35449.

When the window is resized, TanStack can read the new scroll position before its ResizeObserver callback has given it the new viewport height. That makes TimelineView briefly report the reader as no longer at the bottom, which flashes the jump-to-bottom button and made the resize test flaky.

TimelineView now holds back an at-bottom change until TanStack’s height matches the scroller’s real height. Added a test to trigger the issue deterministically.

I(using claude) was able to reproduce the flake a couple of times by applying a lot of cpu throttling. Then did a load of runs with the fix applied and it seems to fix it.

AI assistance

  • I used AI tools to help create this PR.

A scroll read between the scroller resizing and TanStack's ResizeObserver callback paired the new scrollTop with the old height, briefly reporting the reader had left the bottom. Fixes the #35449 flake.
@langleyd

langleyd commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

I've added an upstream fix for this instead(TanStack/virtual#1378) and created a PR bump tanstack and add it to the patch.

@langleyd langleyd closed this Nov 9, 2026
langleyd added a commit that referenced this pull request Nov 9, 2026
When the timeline gets taller the browser moves scrollTop and fires the scroll event before TanStack's ResizeObserver has seen the new height, so an update could pair the new position with the old height and report leaving the bottom (#35449). Our virtual-core patch now reads the size along with the scroll event (TanStack/virtual#1378), and a shrink seen that way still keeps the end in view.

The test is #35727's, which passes without that PR's hold in the view.
langleyd added a commit that referenced this pull request Nov 9, 2026
When the timeline gets taller the browser moves scrollTop and fires the scroll event before TanStack's ResizeObserver has seen the new height, so an update could pair the new position with the old height and report leaving the bottom (#35449). Our virtual-core patch now reads the size along with the scroll event (TanStack/virtual#1378), and a shrink seen that way still keeps the end in view.

The test is #35727's, which passes without that PR's hold in the view.
rbondesson pushed a commit to ZacksBot/element-web that referenced this pull request Nov 13, 2026
…atch (element-hq#35743)

* Compensate rows that grow above the new timeline while scrolling up

TanStack skips the scroll correction for a row that changes height again after it was measured while the user scrolls up (TanStack/virtual#1168), so an image or link preview finishing loading above the viewport shoved the rows on screen. Our virtual-core patch removed that skip; use the escape hatch TanStack provides for it instead, keeping the rest of its default rule.

* Update TanStack Virtual to 3.19.11

Rebases our virtual-core patch. Two of its hunks are covered upstream now (a resize while a scroll is being written builds on the written position) and the backward-scroll one is replaced by TanStack's escape hatch in the view, so they are dropped. The two that remain: isValidAnchorItem, and keeping the end in view when the scroller shrinks (TanStack/virtual#1298, with the review changes).

* Read the scroller's size with each scroll event in the new timeline

When the timeline gets taller the browser moves scrollTop and fires the scroll event before TanStack's ResizeObserver has seen the new height, so an update could pair the new position with the old height and report leaving the bottom (element-hq#35449). Our virtual-core patch now reads the size along with the scroll event (TanStack/virtual#1378), and a shrink seen that way still keeps the end in view.

The test is element-hq#35727's, which passes without that PR's hold in the view.

This branch was successfully deployed

3 active deployments
EndToEndTests — 258da35d Deployed Nov 6, 2026 by github-actions[bot]
SharedComponentStorybook — 258da35d Deployed Nov 6, 2026 by github-actions[bot]
Netlify — 258da35d Deployed Nov 6, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

1 participant