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

[pigment-css] Fix propTypes removal during eval stage #41695

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

brijeshb42
Copy link
Contributor

Conditional assignment of propTypes was not handled resulting in error while using prod builds of material-ui.

Conditional assignment of propTypes was not handled resulting in error
while using prod builds of material-ui.
@brijeshb42 brijeshb42 added the package: pigment-css Specific to @pigment-css/* label Mar 28, 2024
@mui-bot
Copy link

mui-bot commented Mar 28, 2024

Netlify deploy preview

https://deploy-preview-41695--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against b292796

Comment on lines +39 to +52
export function App() {
return (
<Component>
<SliderRail />
<SliderRail2 />
</Component>
);
}

process.env.NODE_ENV !== 'production'
? (App.propTypes = {
children: PropTypes.element,
})
: void 0;
Copy link
Member

Choose a reason for hiding this comment

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

What would happen if the propTypes are not handled? I guess the test will throw during evaluation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct.

Copy link
Contributor Author

@brijeshb42 brijeshb42 Mar 29, 2024

Choose a reason for hiding this comment

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

During evaluation, App gets set to null. So we are setting a value to null object resulting in the error.


App = null;

App.propTypes = {}

@brijeshb42 brijeshb42 merged commit a33a467 into mui:next Mar 29, 2024
19 of 20 checks passed
@brijeshb42 brijeshb42 deleted the pigment/fix-prop-types branch March 29, 2024 04:54
mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Mar 29, 2024
tejasparkar pushed a commit to tejasparkar/material-ui that referenced this pull request Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: pigment-css Specific to @pigment-css/*
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants