Skip to content

Scroll offset with dynamic sizes not working properly in React 16 #647

@hdwatts

Description

@hdwatts

Describe the bug

When adjusting scales of items, the scroll offset is maintained when items get bigger, but are lost in a React 16 environment when items get smaller.

Your minimal, reproducible example

https://codesandbox.io/p/devbox/funny-sound-9dvq49?file=%2Fsrc%2Fmain.tsx%3A92%2C34

Steps to reproduce

  1. Scroll down
  2. Zoom in (Scroll position is maintained, sometimes)
  3. Zoom out (Scroll position is shifted down a third of the page, everytime)

Expected behavior

As a user, my scroll position should remain the same as my items scale, as it is in React 18

React 18 example: https://codesandbox.io/p/devbox/suspicious-orla-wcmzp8?file=%2Fsrc%2Fmain.tsx%3A96%2C37

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: Mac - Browser: Chrome - Version: 120.0.6099.216

tanstack-virtual version

v3.0.1

TypeScript version

4.9.5 and 5.2.2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions