-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Description
Component
DataGrid
Package version
9.66.5
React version
18.2.0
Environment
System:
OS: Windows 11 10.0.26100
CPU: (28) x64 Intel(R) Core(TM) i7-14700K
Memory: 26.18 GB / 63.77 GB
Browsers:
Edge: Chromium (139.0.3405.102)
Internet Explorer: 11.0.26100.1882Current Behavior
When clicking on an already selected row, onSelectionChange fires again with the same set of selected items.
The same behaviour also applies for the List component.
Expected Behavior
Either:
onSelectionChangeshould not trigger unless there is some actual change in selection.- The row should be deselected and
onSelectionChangeshould trigger with 0 items.
Reproduction
https://stackblitz.com/edit/pxsuvgmu?file=src%2Fexample.tsx
Steps to reproduce
- Open: https://stackblitz.com/edit/pxsuvgmu?file=src%2Fexample.tsx
- Click "Foo" row in the grid. The selection change function runs, the current value is
[]and the new value is[1]. - Click the "Foo" row in the grid a second time. The selection change function runs, the current value is
[1]and the new value is[1]
Are you reporting an Accessibility issue?
None
Suggested severity
Medium - Has workaround
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.