-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[data grid] Removing column with turned on aggregation leads to crash #16091
Comments
Hey @rettoua and sry for the late answer. The problem seems to stem from this part of the code, where it cannot find the auto generated aggregation row to process.
That being said we do not recommend using a columns array that has no stable reference. For the grid to work as expected you should never alter the columns array. Wouldn't it be enough to hide the column instead of plain-removing it: column visibility? |
hi @michelengelen, What approach would you recommend for using the DataGrid to meet the following requirements: |
Hey @rettoua ... maybe I picked too extreme wording there. The columns prop should ideally never change. There is definitely the possibility to work with dynamic columns, but it is not the recommended approach. Either way you should make sure that the columns array contains a stable reference during rerenders. This can be done by either define it outside of the component as a constant or by memoizing it. The issue presented here is still valid and should be handled, so I'll add it to the board. |
@michelengelen, |
Steps to reproduce
Steps:
Current behavior
After removing the column from the datagrid following error in thrown:
Expected behavior
No error
Context
In my project, this error occurs without the need to modify the source code – simply removing a column causes a crash. I couldn’t reproduce it in the sandbox, as the datagrid in my project is highly customized.
The issue started occurring after updating
@mui/x-data-grid-premium
to version7.23
. Version7.22
works fine.Two places can 'help' to fix the error:
groupingValueGetter
eliminates errorI suppose there is probably a problem with the cache in the internals of the Datagrid.
Your environment
npx @mui/envinfo
Search keywords: datagrid
Order ID: 100790
The text was updated successfully, but these errors were encountered: