mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.52k stars 1.31k forks source link

[data grid] `useGridVirtualScroller` incorrectly calculates rows to render with opened detail panels after sorting #14356

Open PatoGuereque opened 2 months ago

PatoGuereque commented 2 months ago

Steps to reproduce

Link to live example: https://codesandbox.io/p/sandbox/mui-datagrid-template-forked-mlsxvy

https://github.com/user-attachments/assets/c7f30038-06e0-4ef9-a336-9ad0f3308ccf

  1. Have a grid with detail panels
  2. Expand a detail panel in view of the virtual scroller
  3. Sort the rows to have the detail panel out of view
  4. Watch the blank space on the bottom of the grid

Current behavior

It appears as if the grid is using the positions cache from the pervious render to determine what rows should be rendered. Issue is that it assumes the detail panel is still in view after sortng, causing a blank space at the bottom. This then gets properly calculated when scroll gets triggered.

Expected behaviour

No blank spaces on the bottom of the grid

Search keywords: x-data-grid-pro, master-detail, virtualization Order ID: 96664

michelengelen commented 2 months ago

@PatoGuereque I can confirm this. Will add it to the board! 👍🏼

PatoGuereque commented 2 months ago

Thank you!