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

Add virtualized indexes to itemKey function calls #475

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jribeiro
Copy link

@jribeiro jribeiro commented Jun 6, 2020

Currently only the real data index is passed to the itemKey functions for Grid and List components respectively.

While this is great to be able to get an unique key for each of the rendered items, when the user scrolls, the index will change causing the new key to mismatch the previous and React to unmount and re-mount each component and, as such, recreate the DOM node.

This PR adds a new parameter to the List component itemKey function call, virtualizedIndex which represents the row index relative to the first rendered row. Similarly, for Grids, there's two new properties: virtualizedRowIndexand virtualizedColumnIndex.

Depending on what we're optimising for, using these virtualized values instead can be a performance improvement and IMO it's quite good to have the additional option mostly when the code complexity remains pretty much the same.

Relates to: #234

…ction to allow generating stable component keys while scrolling
@fidelman
Copy link

any progress here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants