TanStack / TanStack/virtual

Scroll correction sometimes gets stuck on estimating row sizes

Open
#1,252 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.1k
Forks
466
Avg merge
2d 31m
Merged PRs (30d)
13

Description

Describe the bug

I think this bug is in the same ballpark to #1221:

We have a complex layout that is (for testing purposes) explicitly undersized and causes layout shifts. This sometimes ends up in an infinite loop trying to correct the scroll position and then stays stuck. Internally we've observed this on some of our playwright tests and eventually found a reproduction.

Oddly enough this behavior can be "fixed" by halting the js execution for a frame and then continue, which makes me suspect that the measurement cache or layout measurement is derived from an outdated layout box.

If necessary, I can try to create a specific sandboxed reproduction.

Your minimal, reproducible example

no reproduction as of yet

Steps to reproduce
  1. Have a layout with virtualized lines that sometime wrap lines (and therefore differ from the size in estimateSize)
  2. scroll up/down with the affected rows appearing/disappearing from the virtualized range
Expected behavior

Table layout should not jitter.

How often does this bug happen?

Every time

Screenshots or Videos

https://github.com/user-attachments/assets/25dbf5de-1f12-442e-8d81-582b1cad8f64

Platform
  • OS: MacOS, Windows
  • Browser: Firefox, Chrome
  • @tanstack/react-virtual: 3.13.9 ... 3.14.9
tanstack-virtual version

3.14.9

TypeScript version

v7.0.0

Additional context

No response

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the @tanstack/react-virtual measurement cache and scroll-correction behavior, then reproduce the listed wrapping-row scenario while comparing it with the attached video. A useful reproduction is still needed; done means the layout no longer jitters or enters an infinite scroll-correction loop when rows appear or disappear.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.