Skip to content

[internal] Update slot components to use overridesResolver part 1#25853

Merged
mnajdova merged 4 commits into
mui:nextfrom
mnajdova:feat/update-slots-override-resolvers
Apr 21, 2021
Merged

[internal] Update slot components to use overridesResolver part 1#25853
mnajdova merged 4 commits into
mui:nextfrom
mnajdova:feat/update-slots-override-resolvers

Conversation

@mnajdova

@mnajdova mnajdova commented Apr 20, 2021

Copy link
Copy Markdown
Member

This PR updates the components starting with A to use overridesResolver per slot component. (need to somehow batch the changes in few PRs, otherwise the PR would be too big).

I am disabling the testDeepOverrides as we no longer support it. In some cases we still need to define the overrides on the root, for example in the AvatarGroup, when we are just applying the classes on a component down the tree, which is not created by a styled() utility.


I've done some preliminary benchmark in #25850 and seems like perf are great with this approach.

const { styleProps } = props;

return {
[`& .${accordionClasses.region}`]: styles.region,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There is no component for this one.

@mui-pr-bot

mui-pr-bot commented Apr 20, 2021

Copy link
Copy Markdown

Details of bundle changes

Generated by 🚫 dangerJS against 9b94358

const overridesResolver = (props, styles) => {
return deepmerge(
{
[`& .${avatarGroupClasses.avatar}`]: styles.avatar,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a good example where this approach may not work everywhere. In this case we need to still keep this, otherwise it won't work.

Comment on lines +71 to +79
[`& .${autocompleteClasses.tag}`]: {
...styles.tag,
...styles[`tagSize${capitalize(size)}`],
},
[`& .${autocompleteClasses.inputRoot}`]: styles.inputRoot,
[`& .${autocompleteClasses.input}`]: {
...styles.input,
...(inputFocused && styles.inputFocused),
},

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There are no slot components for these overrides keys, so we need to keep them

@mnajdova
mnajdova marked this pull request as ready for review April 20, 2021 15:51

@oliviertassinari oliviertassinari left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good

@mnajdova

Copy link
Copy Markdown
Member Author

Looks good

👍 ok let's continue with the rest of the components.

@mnajdova mnajdova changed the title [core] Update slot components to use overridesResolver [core] Update slot components to use overridesResolver part 1 Apr 21, 2021
@mnajdova
mnajdova merged commit de07013 into mui:next Apr 21, 2021
@oliviertassinari oliviertassinari added the internal Behind-the-scenes enhancement. Formerly called “core”. label Apr 21, 2021
@oliviertassinari oliviertassinari changed the title [core] Update slot components to use overridesResolver part 1 [internal] Update slot components to use overridesResolver part 1 Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Behind-the-scenes enhancement. Formerly called “core”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants