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

[DataGridPremium] Fix incorrect rows selection count when selection propagation is enabled with row grouping #15216

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

arminmeh
Copy link
Contributor

Fixes #15206

The issue occurs when rowSelectionPropagation is used on a grid with grouped columns and the data is updated.
After update, new selection lookup is being created, but the autogenerated rows are being added multiple times to the selection lookup array

Thing is, API to fetch the selection list uses selector that returns a Map, which removes duplicate values, so the issue is only visible on the count (which operates on the actual array).

Now, the selection lookup is rebuilt using the Map as well.

Duplicate values are coming from checking the parent for selection for each grouped row

@arminmeh arminmeh added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! plan: Premium Impact at least one Premium user feature: Selection Related to the data grid Selection feature needs cherry-pick The PR should be cherry-picked to master after merge labels Oct 31, 2024
@arminmeh arminmeh requested a review from a team October 31, 2024 14:54
@arminmeh arminmeh changed the title Use set to prevent duplicate keys in a new selection lookup [DataGridPro] Incorrect Row Selected Count with Row Grouping Oct 31, 2024
@arminmeh arminmeh changed the title [DataGridPro] Incorrect Row Selected Count with Row Grouping [DataGridPremium] Fix incorrect rows selection count when selection propagation is enabled with row grouping Oct 31, 2024
@mui-bot
Copy link

mui-bot commented Oct 31, 2024

Deploy preview: https://deploy-preview-15216--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 356d9d7

@arminmeh arminmeh enabled auto-merge (squash) October 31, 2024 15:28
@arminmeh arminmeh merged commit 44d1357 into mui:master Oct 31, 2024
28 checks passed
github-actions bot pushed a commit that referenced this pull request Oct 31, 2024
@arminmeh arminmeh deleted the fix-selected-rows-count-after-update branch October 31, 2024 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Selection Related to the data grid Selection feature needs cherry-pick The PR should be cherry-picked to master after merge plan: Premium Impact at least one Premium user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Incorrect Row Selected Count with Row Grouping
3 participants