Skip to content
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] Component rendering 3 times on row selection, and every cell also re-rendering #16473

Open
costinelul opened this issue Feb 5, 2025 · 1 comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information

Comments

@costinelul
Copy link

costinelul commented Feb 5, 2025

Steps to reproduce

Version: "@mui/base": "^5.0.0-beta.30"
Steps:

  1. Click a checkbox from default checkbox selection

Current behavior

I am using React Profiler and I noticed that the component DataGrid renders 3 times after clicking on a checkbox from the default checkbox selection component. Frist time it renders because the selection model changed , and then it rerenders 2 additional times ( the reason from the ReactProfiler is that the state of the internal DataGrid changed).
When there aren't many rows it's not noticeable, but when there are a lot of columns and rows, the selection is very laggy.

This is the first re-render triggered by the selection model change;
Image

These are the 2nd and 3rd re-renders, trigger by Hook 24, which I checked and is the Grid's state ( which includes the selection model)
Image

Expected behavior

I don't know if I am missing something, but I would expect only the checkbox selection column to re-render when clicking on a checkbox, and certainly only once. Could the 3 re-renders be necessary? But why the other cells?

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: Mui Data Grid DataGrid render rerender row selection

@costinelul costinelul added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 5, 2025
@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label Feb 6, 2025
@KenanYusuf KenanYusuf changed the title Component rendering 3 times on row selection, and every cell also re-rendering [data grid] Component rendering 3 times on row selection, and every cell also re-rendering Feb 6, 2025
@KenanYusuf
Copy link
Member

Hi @costinelul, thanks for raising the issue. Please could you confirm your environment information? You can run npx @mui/envinfo in your project root which can then be attached to the issue description.

@KenanYusuf KenanYusuf added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

3 participants