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

[Popper] Fix bundle size regression #27910

Merged

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Aug 22, 2021

@oliviertassinari oliviertassinari added component: Popper The React component. See <Popup> for the latest version. performance labels Aug 22, 2021
@mui-pr-bot
Copy link

mui-pr-bot commented Aug 22, 2021

Details of bundle changes (experimental)

Generated by 🚫 dangerJS against 77b7a77

@oliviertassinari oliviertassinari added the regression A bug, but worse label Aug 22, 2021
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Aug 22, 2021

As far as I know, the regression comes from #25984. But it wasn't reported, nor does the improvement here is reported in the mui-pr-bot's comment. I had to open the links to check. I would propose we display a summary of the important bundle size changes in the mui-pr-bot's comment. cc @eps1lon

@oliviertassinari oliviertassinari marked this pull request as ready for review August 22, 2021 10:20
@@ -2,7 +2,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import { createPopper } from '@popperjs/core';
import { chainPropTypes, refType, HTMLElementType } from '@material-ui/utils';
import { useTheme } from '../styles';
import { useThemeWithoutDefault as useTheme } from '@material-ui/system';
Copy link
Member

Choose a reason for hiding this comment

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

This is part of the core library so it needs the default theme. Same applies to the other components.

Copy link
Member Author

Choose a reason for hiding this comment

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

Please explain why the default theme matters in this context. I don't see the link with the core.

To be clear, we haven't been using the default theme for a long time here. I have made this PR quickly after we changed the behavior.

Copy link
Member

Choose a reason for hiding this comment

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

Please explain why the default theme matters in this context. I don't see the link with the core.
To be clear, we haven't been using the default theme for a long time here. I have made this PR quickly after we changed the behavior.

I forgot that you just argue for consistency when it suites you. But generally, the Popper is not conform with the other /material components regarding default props.

Copy link
Member Author

Choose a reason for hiding this comment

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

By not conform, do you mean that there is a difference in behavior? I didn't notice it, if you could highlight it, I think that it would be great. As far as I know, there are no behavior changes. This PR trims default values of the theme that the component doesn't depend on.

Regarding consistency, I personally don't think that it's a target on its own, but a tool to 1. surface miss opportunities in how we solve problems, e.g. Does it really need two different solutions here? 2. to minimize the learning curve e.g. As a user, to be able to transfer API knowledge from one component to another.

Regarding what suites me, I think that it's about: Are we OK to cherry-pick only the default values of the theme the component needs for the sake of reducing the bundle size when importing a single component? I personally think that the answer is yes because it ease the adoption of the library. As a developer you do no longer feel that you have to import multiple components to get a return on the initial bundle size overhead.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 1, 2021
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 2, 2021
@oliviertassinari oliviertassinari merged commit 79cbd85 into mui:next Sep 2, 2021
@oliviertassinari oliviertassinari deleted the fix-popper-bundle-size-regression branch September 2, 2021 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Popper The React component. See <Popup> for the latest version. performance regression A bug, but worse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants