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

[DataGrid] Avoid re-rendering all cells on column change #12980

Merged
merged 13 commits into from
May 30, 2024

Conversation

romgrk
Copy link
Contributor

@romgrk romgrk commented May 2, 2024

Closes #12952

This change prevents all columns from re-rendering when one column is changed.

Before: https://codesandbox.io/p/sandbox/friendly-montalcini-yfkfvd
After: https://codesandbox.io/p/sandbox/black-brook-jr7r3d?file=%2Fsrc%2FApp.tsx

@romgrk romgrk added performance component: data grid This is the name of the generic UI component, not the React module! labels May 2, 2024
@romgrk romgrk requested review from MBilalShafi and cherniavskii May 2, 2024 19:09
@mui-bot
Copy link

mui-bot commented May 2, 2024

Deploy preview: https://deploy-preview-12980--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against ab5ca81

Copy link
Member

@MBilalShafi MBilalShafi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one 👌
I don't understand though why it was being mutated previously, is this something that was previously required for some reason (maybe in the non-sticky headers)? 🤔

@romgrk romgrk enabled auto-merge (squash) May 6, 2024 16:38
@romgrk romgrk disabled auto-merge May 6, 2024 16:46
Copy link
Member

@cherniavskii cherniavskii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test for this use case?

@romgrk romgrk force-pushed the perf-avoid-render-cells-column-change branch 2 times, most recently from 52b949c to 3d49cb9 Compare May 22, 2024 21:30
@romgrk romgrk merged commit c6b6c5d into mui:master May 30, 2024
17 checks passed
@romgrk romgrk deleted the perf-avoid-render-cells-column-change branch May 30, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Is there a way to update a single ColDef without triggering a re-render of every cell?
4 participants