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

Fix rerender caused by style override #4490

Merged
merged 1 commit into from
Mar 9, 2020
Merged

Conversation

fzaninotto
Copy link
Member

Problem

  1. Many components allow style override by way of a custom classes prop (as accepted by useStyles), but implement it a way that causes unwanted re-renders (useStyles({ classes: classesOverride }), which defeats React.memo because the parameter is always a new object) and harm performance
  2. Some components allow style override by will pass the classes prop down to their children

Solution

This PR makes all components work the same way:

  • either they allow style override by classes, in which case it's performant and dosn't leak, or
  • they don't allow style override.

This change is backwards compatible.

@fzaninotto fzaninotto added the RFR Ready For Review label Mar 8, 2020
@djhi djhi added this to the 3.3.1 milestone Mar 9, 2020
@djhi djhi merged commit 94b0828 into master Mar 9, 2020
@djhi djhi deleted the normalize-useStyles-props branch March 9, 2020 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants