Skip to content

Previous List Items Page Lost Scroll Position When Navigated Back #551

@davie1989

Description

@davie1989

Describe the bug

Hello,

This might not really be a bug per say. But I do noticed that when I render a list, then I clicked on one list to navigate to another page, when I navigate back or click the browser back button, my previous scroll position is maintained which is fine. But this is when I am still in the first few list.

When I scroll down a lot and clicked on a list to navigate to another page, upon coming back, I expect to see the list that I clicked on. However, it seems the page lost its position. I would rather see another list item.

Let me mention that my list are in dynamic sizes and I am using the useWindowVirtualizer.

Attached codesandbox link is just a minimal sample.

Thanks.

Your minimal, reproducible example

https://codesandbox.io/s/cold-bird-qmsbtf?file=/src/App.js

Steps to reproduce

  1. Render your list items.
  2. Click on an item to navigate to another page,
  3. upon coming back, the scroll position is lost.

Expected behavior

I expect the list scroll position to still be maintained.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Windows, Chrome

tanstack-virtual version

3.0.0-beta.54

TypeScript version

No response

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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions