Skip to content

Multiple virtuoso tabs preserving scroll (Slack-like application) - Best practice #885

Answered by petyosi
luap2703 asked this question in Q&A
Discussion options

You must be logged in to vote

@paulo2703 after examining your setup, I can see that there's no reasonable way to implement location persistence with the APIs present in v4.2. The problem is not due to your implementation, or the overscan/increaseViewportBy, but due to the data set changes causing loss of previous measurement data. Your usage of the key attribute is correct, as technically, you're rendering a new list.

To address that, I just released v4.3 which has a new API that lets you to get / restore the component internal state - this includes the measured item heights and the scroll position. You can check how it works in this example. Check the getState ref method and the restoreStateFrom attribute.

Let me kno…

Replies: 5 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@luap2703
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by luap2703
Comment options

You must be logged in to vote
1 reply
@petyosi
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@luap2703
Comment options

@luap2703
Comment options

@petyosi
Comment options

@luap2703
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants