-
-
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] Cells are rerendered on every click #7807
Comments
At the very least, I need an example of how to cache a rendered cell. I have tried caching a result of
but that didn't help much. Even assuming that response doesn't change, the |
I have checked it with the profiler and everything is being rendered for some reason. bandicam.2023-02-03.12-01-46-957.mp4I think it should have been like this. bandicam.2023-02-03.12-13-58-314.mp4 |
Yes, this happens because each cell is responsible for calling
You could try wrapping |
hey @m4theushw, anything you do in the datagrid causes every componet(ColumnHeader, footer, row, cell) to rerender, even moving the mouse in and out of the datagrid is causing rerender. bandicam.2023-02-05.21-18-50-797.mp4 |
At the current state we can't easy solve this issue because the state of the grid is all stored in the same place, so if the parent component re-renders, their children will also re-render. Also, we can't wrap all components in |
I've been working in a way to allow to use |
it's perfect now, the only problem I had was, with the custom cell, I had to memorize it myself. |
@m4theushw : Really appreciation if memorize of rows, cells and column can get in place! Will test your commit and report back: https://pkg.csb.dev/mui/mui-x/commit/794239b6/@mui/x-data-grid <3 Note: Already memoized my custom renderCell, but it seem that the apiRef used through the passed props makes this problematic. |
@rompeldunk Almost yes, I'm actually only wrapping the default components in
Only memoizing |
@m4theushw Would it be possible to test an equivalent PR to x-data-grid-pro? We're trying to render many hundreds, up to many thousand of rows. One checkboxSelection event renders the whole stack. Also tested with renderCell disabled, but as you mentioned, it doesn't matter much. <DataGridPro
rows={rows}
columns={browseColumns}
columnBuffer={3}
rowHeight={32}
autoHeight
autoPageSize
components={{
// Memoized comp's here
}}
disableSelectionOnClick={true}
checkboxSelection
rowBuffer={3}
onSelectionModelChange={handleSetSelectedRowIds}
onCellEditCommit={handleCellEditCommit}
onColumnHeaderClick={handleColumnHeaderClick}
/> |
@rompeldunk
Yes, you can find links to the packages in the Packages section of Codesandbox CI build: https://ci.codesandbox.io/status/mui/mui-x/pr/7846/builds/344182 |
@cherniavskii I tested this one: Currently using "@mui/x-data-grid-pro": "5.15.1", |
Just to clarify: (in my use-case at least)
|
Yes, it's v6. We do not plan to release this improvement on v5 since we are going to release v6 stable during the next 3-4 weeks. |
@rompeldunk Partially yes, but the problem here appears before reaching |
Is there a specific use case where you can observe the data grid performance degradation? |
Since the issue is missing key information and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information. |
Still facing the problem. The whole DataGrid is rerendered on every cell or row click, all rows and cells are rendered. It causes a significant performance issue with a table over about hundred cells |
Order ID 💳
52426
Duplicates
Latest version
The problem in depth 🔍
Same as:
#3480 (comment)
I just need you to confirm that a trivial UI operation is still causing unnecessary rerendering of all the cells (which is ridiculous).
Sandbox:
https://codesandbox.io/s/datagrid-rerendering-issue-tzdri2
just click around and watch Value column being rerendered.
The issue:
In my actual use case cells are rendered with 4 buttons inside. Even scrolling becomes too sluggish. I'm questioning whether this component would be usable in the UI.
Your environment 🌎
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: