Skip to content

[DataGrid] Fix theme defaultProps causing unwanted re-renders #17490

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

Merged
merged 2 commits into from
Apr 24, 2025

Conversation

KenanYusuf
Copy link
Member

@KenanYusuf KenanYusuf commented Apr 22, 2025

This PR is fixes #17128 using an alternate approach to mui/material-ui#45943

Before

All cells change value when entering edit mode.

https://codesandbox.io/p/sandbox/17490-before-76t4mt

before.mov

After

Only the selected cell changes value when entering edit mode.

https://codesandbox.io/p/sandbox/17490-after-ftlktq

after.mov

Copy link

github-actions bot commented Apr 22, 2025

Thanks for adding a type label to the PR! 👍

@KenanYusuf KenanYusuf added performance component: data grid This is the name of the generic UI component, not the React module! bug 🐛 Something doesn't work labels Apr 22, 2025
@KenanYusuf KenanYusuf changed the title [DataGrid] Fix themed props causing unwanted re-renders [DataGrid] Fix theme defaultProps props causing unwanted re-renders Apr 22, 2025
@KenanYusuf KenanYusuf changed the title [DataGrid] Fix theme defaultProps props causing unwanted re-renders [DataGrid] Fix theme defaultProps causing unwanted re-renders Apr 22, 2025
@mui-bot
Copy link

mui-bot commented Apr 22, 2025

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

Generated by 🚫 dangerJS against 5581da6

@@ -64,12 +65,11 @@ export const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES: DataGridPremiumPropsWithDef
const defaultSlots = DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS;

export const useDataGridPremiumProps = (inProps: DataGridPremiumProps) => {
const themedProps =
// eslint-disable-next-line material-ui/mui-name-matches-component-name
useThemeProps({
Copy link
Member Author

Choose a reason for hiding this comment

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

The returned value from useThemeProps is not memoized. See mui/material-ui#45943

@KenanYusuf KenanYusuf marked this pull request as ready for review April 22, 2025 14:01
@KenanYusuf KenanYusuf requested review from siriwatknp and a team April 22, 2025 14:01
@KenanYusuf KenanYusuf added needs cherry-pick The PR should be cherry-picked to master after merge v7.x labels Apr 23, 2025
@KenanYusuf KenanYusuf merged commit 89606a1 into mui:master Apr 24, 2025
25 checks passed
@KenanYusuf KenanYusuf deleted the memoize-themed-props branch April 24, 2025 11:47
Copy link

Cherry-pick PRs will be created targeting branches: v7.x

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! needs cherry-pick The PR should be cherry-picked to master after merge performance v7.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Theme MuiDataGrid.defaultProps makes all cells re-render
5 participants