react-virtuoso icon indicating copy to clipboard operation
react-virtuoso copied to clipboard

[BUG] restoreStateFrom never restoring correctly for VirtuosoGrid

Open mbret opened this issue 6 months ago • 2 comments

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 avatar Jul 30 '24 14:07 mbret