[data grid] using treeData and onRowSelectionModelChange with controlled rowSelectionModel causing infinite render loop #15217
Labels
bug 🐛
Something doesn't work
component: data grid
This is the name of the generic UI component, not the React module!
support: premium standard
Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Steps to reproduce
Link to live example: (required)
Steps:
Here's a video of the behavior:
https://github.com/user-attachments/assets/253ec8c4-b2ed-4154-a3af-4c5d59bea555
Current behavior
In the case when we're using
treeData
andonRowSelectionModelChange
with controlledrowSelectionModel
- the selected row toggles between selected and unselected when the row selection checkbox is used.Expected behavior
In the case when we're using
treeData
andonRowSelectionModelChange
with controlledrowSelectionModel
- the selected row reflects it's selected state when remains selected when using the row selection checkbox.Context
When you click a row to select row selection, the component goes into an infinite loop of calling
onRowSelectionModelChange
. The first time it calls it, it contains the id of the row you just selected and then it is called again with an empty list in the case of this example, causing the flashing behavior. In general,onRowSelectionModelChange
gets called again with whatever therowSelectionModel
was before the click occurred. For example, if there's an initially selected row when it first mounts - it will go back to that.It appears as though this issue was introduced in 7.19.0.
I'm not sure if it's related to other
onRowSelectionModelChange
open issues. This could potentially be related: #14859Your environment
npx @mui/envinfo
Search keywords: data grid premium pro treeData onRowSelectionModelChange rowSelectionModel rowSelection
Order ID: 82849
The text was updated successfully, but these errors were encountered: