virtual icon indicating copy to clipboard operation
virtual copied to clipboard

Scrolling up in Lit example stutters and resets scroll

Open blake-logik opened this issue 8 months ago • 1 comments

Describe the bug

I was having problems with my Lit virtualizer stuttering when scrolling back up through a dynamic list and couldn't understand why the example worked, but mine did not. So I updated the height of the items in the example, and it started to break like mine. It seems the example only works well because each item takes up most of the scroll element.

Your minimal, reproducible example

https://tanstack.com/virtual/latest/docs/framework/lit/examples/dynamic?panel=sandbox

Steps to reproduce

  1. Open the Lit dynamic example: https://tanstack.com/virtual/latest/docs/framework/lit/examples/dynamic?panel=sandbox
  2. Change the lorem ipsum generator to make shorter sentences ex. faker.lorem.sentence(randomNumber(1, 20))
  3. Scroll down a ways and then scroll back up. It will start stuttering and reseting scroll. This gets worse the larger the difference in height between items.

Expected behavior

There should not be any stutter.

How often does this bug happen?

Often

Screenshots or Videos

No response

Platform

  • OS: Mac
  • Browser: Chrome

tanstack-virtual version

v3

TypeScript version

No response

Additional context

No response

Terms & Code of Conduct

  • [x] I agree to follow this project's Code of Conduct
  • [x] 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.

blake-logik avatar Apr 10 '25 16:04 blake-logik

A similar problem was encountered in the Vue package, maybe you can find workaround in another issues

ghost avatar Apr 24 '25 23:04 ghost