Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] restoreStateFrom never restoring correctly for VirtuosoGrid #1114

Open
mbret opened this issue Jul 30, 2024 · 2 comments
Open

[BUG] restoreStateFrom never restoring correctly for VirtuosoGrid #1114

mbret opened this issue Jul 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@mbret
Copy link

mbret commented Jul 30, 2024

Describe the bug
The restoreStateFrom property doesn't restore the scroll position correctly despite the data hasn't changed.

I followed the example in (https://github.com/petyosi/react-virtuoso/blob/master/examples/state.tsx), and created a CodeSandbox example to test it out. When I repeatedly click on the Log State, the list always fails to restore the state and goes back to the start of the list.

Reproduction
codesandbox

To Reproduce

Scroll down in the list to an item (e.g. Item 28)
Click on the Log State button multiple times
Expected behavior
The list should remain the same scroll position after each click of the Log State button, but instead sometimes it fails to restore the scroll position and resets the scroll position to the top of the list.

Desktop (please complete the following information):

OS: Ubuntu
Chrome, Firefox, Safari

@mbret mbret added the bug Something isn't working label Jul 30, 2024
@hedgie001
Copy link

hedgie001 commented Aug 6, 2024

I have a same bug and recreated it based on @mbret's example:
It's a simple navigation example where the current GridStateSnapshot is stored into the context. After navigating back to the List, the Grid should scroll back to its original position.

Reproduction
Open in CodeSandbox

Scroll down in the list to an item (e.g. Item 128), then click on the "Back" Button

Expected Behaviour
The List should restore its state.
The log shows the correct scrollTop value but the VirtuosoGrid doesn't apply this to the Component (restoreStateFrom).

Desktop
Chrome, Safari, Firefox

@petyosi
Copy link
Owner

petyosi commented Aug 6, 2024

Confirming, it's a legit bug, the reproduction is a valid one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants