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

[core] Fix ReferenceError in browser builds without process polyfill #13164

Closed
wants to merge 1 commit into from

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Oct 9, 2018

Closes #13163

@eps1lon eps1lon force-pushed the fix/core/browser-build-process branch from 8f2f579 to 8cf7abb Compare October 9, 2018 06:48
@oliviertassinari
Copy link
Member

oliviertassinari commented Oct 9, 2018

Maybe we shouldn't have MUI_SUPPRESS_DEPRECATION_WARNINGS at all, only rely on the theme?

@eps1lon
Copy link
Member Author

eps1lon commented Oct 9, 2018

@oliviertassinari I didn't know any other solution for our unit tests that didn't involve rewriting all of them.

@eps1lon eps1lon force-pushed the fix/core/browser-build-process branch from 8cf7abb to 0eae2c7 Compare October 9, 2018 12:10
@eps1lon eps1lon force-pushed the fix/core/browser-build-process branch from 0eae2c7 to 7c1ee6f Compare October 9, 2018 14:39
@oliviertassinari
Copy link
Member

I didn't know any other solution for our unit tests that didn't involve rewriting all of them.

@eps1lon The current solution is hiding valuable warnings. For instance, yesterday, I have discovered an issue with the legacy button variants: https://github.com/mui-org/material-ui/pull/13158/files#diff-4175d84e63a1a5a340986f250b17c796R108.

@@ -227,13 +227,13 @@ function Button(props) {
} = props;

warning(
process.env.MUI_SUPPRESS_DEPRECATION_WARNINGS || variant !== 'flat',
getEnv('MUI_SUPPRESS_DEPRECATION_WARNINGS') || variant !== 'flat',
Copy link
Member

Choose a reason for hiding this comment

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

I think that we can safely remove MUI_SUPPRESS_DEPRECATION_WARNINGS here. I have already updated the tests to handle it.

@@ -27,7 +28,7 @@ export default function createTypography(palette, typography) {
// Tell Material-UI what's the font-size on the html element.
// 16px is the default font-size used by browsers.
htmlFontSize = 16,
suppressDeprecationWarnings = process.env.MUI_SUPPRESS_DEPRECATION_WARNINGS,
suppressDeprecationWarnings = getEnv('MUI_SUPPRESS_DEPRECATION_WARNINGS'),
Copy link
Member

@oliviertassinari oliviertassinari Oct 9, 2018

Choose a reason for hiding this comment

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

suppressDeprecationWarnings is only used in the Typography component. moving MUI_SUPPRESS_DEPRECATION_WARNINGS there helps with code splitting.

@eps1lon
Copy link
Member Author

eps1lon commented Oct 9, 2018

@oliviertassinari
So instead of ignoring only deprecation warning we now ignore every warning in those button tests. I don't think that's useful at all. Have you tried running the unit tests without that variable set? We could go ahead and write a utility function that filters deprecation warnings but I don't think users want to do the same thing when we can simply offer a feature flag via env variable.

Deprecation warnings are not something that needs fixing in our codebase at this moment. They are only for the user that want to prepare for the next major. If they don't want to migrate then they can simply suppress deprecation warnings and pin to MAJOR.

@oliviertassinari
Copy link
Member

I don't think that's useful at all.

@eps1lon We have left variants behind when introducing the warnings. I looking for a solution to limit this possibility as much as possible. Maybe we should collect the warnings in the visual regression tests and throw if we see one.

If they don't want to migrate then they can simply suppress deprecation warnings and pin to MAJOR.

Have you ever seen React providing a way (in the public API) to suppress deprecation warnings? Not I'm aware of. It's done on purpose. If I had to guess it's because it's an incentive for people to upgrade.

@eps1lon
Copy link
Member Author

eps1lon commented Oct 9, 2018

I don't think that's useful at all.

@eps1lon We have left variants behind when introducing the warnings.

The button variant deprecation did not need the env variable, correct. For symmetry I wanted users to have the opportunity for every deprecation. I should've checked for remnants but since they were already documented as deprecated I assumed this was already done.

If they don't want to migrate then they can simply suppress deprecation warnings and pin to MAJOR.

Have you ever seen React providing a way (in the public API) to suppress deprecation warnings? Not I'm aware of. It's done on purpose. If I had to guess it's because it's an incentive for people to upgrade.

Then we don't do it the next time. There were no objections during review of the PR that introduced them.

@oliviertassinari
Copy link
Member

There were no objections during review of the PR that introduced them.

I'm only using this argument because we can leverage it to simplify the situation :)

@eps1lon eps1lon deleted the fix/core/browser-build-process branch February 25, 2019 20:53
@zannager zannager added the core Infrastructure work going on behind the scenes label Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression for browser usage when upgrading from 3.1.2 -> 3.2.0
3 participants