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

[utils] Fix lazy and memo components issuing forward ref warnings #15322

Merged
merged 1 commit into from Apr 12, 2019

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Apr 11, 2019

React.lazy and React.memo are thin wrappers. The ref is automatically forwarded to the inner component. This can potentially hide ref warnings but we don't have proper tools for introspection.

@eps1lon eps1lon added bug 🐛 Something doesn't work package: utils (private) Specific to the private @mui/utils package labels Apr 11, 2019
function assertPass(Component, options = {}) {
const { failsOnMount = false, shouldMount = true } = options;

checkPropType(Component);
if (shouldMount) {
mount(<Component ref={React.createRef()} />);
ReactDOM.render(
<React.Suspense fallback={<p />}>
Copy link
Member Author

Choose a reason for hiding this comment

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

enzyme doesn't understand Suspense yet (Unknown tag 13).

@mui-pr-bot
Copy link

mui-pr-bot commented Apr 11, 2019

@material-ui/core: parsed: +Infinity% , gzip: +Infinity%
@material-ui/lab: parsed: +Infinity% , gzip: +Infinity%
@material-ui/styles: parsed: +Infinity% , gzip: +Infinity%
@material-ui/system: parsed: +Infinity% , gzip: +Infinity%

Details of bundle changes.

Comparing: 6a6e360...ad2289d

bundle parsed diff gzip diff prev parsed current parsed prev gzip current gzip
@material-ui/core +Infinity% 🔺 +Infinity% 🔺 0 346,653 0 89,716
@material-ui/core/Paper +Infinity% 🔺 +Infinity% 🔺 0 68,376 0 20,044
@material-ui/core/Paper.esm +Infinity% 🔺 +Infinity% 🔺 0 60,735 0 18,787
@material-ui/core/Popper +Infinity% 🔺 +Infinity% 🔺 0 34,910 0 11,907
@material-ui/core/styles/createMuiTheme +Infinity% 🔺 +Infinity% 🔺 0 17,877 0 5,962
@material-ui/core/useMediaQuery +Infinity% 🔺 +Infinity% 🔺 0 2,463 0 1,044
@material-ui/lab +Infinity% 🔺 +Infinity% 🔺 0 148,063 0 43,905
@material-ui/styles +Infinity% 🔺 +Infinity% 🔺 0 53,115 0 15,434
@material-ui/system +Infinity% 🔺 +Infinity% 🔺 0 17,132 0 4,519
Button +Infinity% 🔺 +Infinity% 🔺 0 88,669 0 26,429
Modal +Infinity% 🔺 +Infinity% 🔺 0 82,696 0 24,793
colorManipulator +Infinity% 🔺 +Infinity% 🔺 0 3,745 0 1,537
docs.landing +Infinity% 🔺 +Infinity% 🔺 0 50,908 0 11,210
docs.main +Infinity% 🔺 +Infinity% 🔺 0 649,936 0 202,321
packages/material-ui/build/umd/material-ui.production.min.js +Infinity% 🔺 +Infinity% 🔺 0 295,431 0 82,684

Generated by 🚫 dangerJS against ad2289d

@eps1lon eps1lon force-pushed the fix/utils/elements-accepting-refs branch from 50165fa to ad2289d Compare April 11, 2019 21:59
@eps1lon eps1lon merged commit 468c694 into mui:next Apr 12, 2019
@eps1lon eps1lon deleted the fix/utils/elements-accepting-refs branch April 12, 2019 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work package: utils (private) Specific to the private @mui/utils package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants