Skip to content

fix: Add row ids to the virtualizer #6481

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

Merged
merged 1 commit into from
Jun 24, 2025
Merged

Conversation

vbustamante
Copy link
Contributor

How does this PR change the system?

We were getting a component grid bug when changing the groupby criteria, where the rows would always have the position of the first group criteria selected. This happened because when changing criteria in a way that retained the same count of items, tanstack virtualizer would not recompute sizes.

The trigger for recomputing display data is either the size of the list (that would not change in this case) and a couple of options including the key. Since the key is by default the id of the row, nothing would be done. Adding code to make sure different row types have different keys fixed the issue, after an hour of suffering.

This was not spelled out explicitly in the documentation, so thank god for js libraries being open source. This is where the library spells out its reactivity triggers: https://github.com/TanStack/virtual/blob/2c703821d6f80295fc4da948716c514e9a92c43f/packages/virtual-core/src/index.ts#L614-L638

In short: 🔗

@github-actions github-actions bot added the A-web label Jun 24, 2025
Copy link

github-actions bot commented Jun 24, 2025

Dependency Review

✅ No vulnerabilities or OpenSSF Scorecard issues found.

Scanned Files

None

Signed-off-by: Victor Bustamante <victor@systeminit.com>
@vbustamante vbustamante force-pushed the victor/eng-3082-group-by branch from 5e3f656 to f0b7ac0 Compare June 24, 2025 20:08
Copy link
Contributor

@wendybujalski wendybujalski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such a nasty bug, such a wonderful fix 👍

@wendybujalski wendybujalski added this pull request to the merge queue Jun 24, 2025
Merged via the queue into main with commit a5d2aa6 Jun 24, 2025
10 checks passed
@wendybujalski wendybujalski deleted the victor/eng-3082-group-by branch June 24, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy