[data grid] Updating Columns and Column Grouping Simultaneously and Repeatedly throws Runtime Errors #13985
Labels
component: data grid
This is the name of the generic UI component, not the React module!
regression
A bug, but worse
support: premium standard
Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Steps to reproduce
Press the button in the reproductions once:
Reproduction v7: https://codesandbox.io/s/reproduction-column-grouping-v7-6qw5qv?file=/src/Demo.tsx
Reproduction v6: https://codesandbox.io/s/reproduction-column-grouping-v6-d6m28s?file=/src/Demo.tsx
The issue arises when
columns
andcolumnGrouping
are updated at the same time, at least two times, in a short time period.Current behavior
Current behavior:
DataGrid throws an error. Depending on the browser and the version:
apiRef.current.getColumn(...) is undefined
Cannot read properties of undefined (reading 'computedWidth')
visibleColumnGroupHeader[0] is undefined
Cannot read properties of undefined (reading 'columnFields')
Expected behavior
No error, because the provided props are consistent at any point in time.
Context
This bug is blocking our migration from DataGrid v5 to v6. In v5, this worked without problems.
We use this set of features to load and display new columns on request and remove columns that aren't relevant any longer. We can't always ensure that there is only one re-render due to multiple data sources.
We found these issues describing similar bugs. However, none of their PRs fully fix this problem.
#8602, #8492
Patch that solves the error - tested in v6
If it helps to solve this quicker, we can open a PR based on the changes shown in the diff. Let me know.
Your environment
bunx @mui/envinfo
Search keywords: Columns, column grouping, multiple re-renders
Order ID: 72553Renewed Order ID: 95800
The text was updated successfully, but these errors were encountered: