@material-ui/core: 4.1.2
Re-produce: use react material live site & CodeSandbox demo.
Confirmed reproduction: https://codesandbox.io/embed/y6lzd
Opened success snackbar and got the type error.
Confirmed on the material-ui website too.
Should we uniquely fix the demo? Do we have a better alternative in the core?
When the demo will be fix, i think the component will be usable.
@klein-h The demo fix is simple, it's about adding React.forwardRef.
Should we uniquely fix the demo?
I'm fixing the demo and add a prop-type warning. The child of Snackbar needs to be able to hold a ref since we switched to @material-ui/react-transition-group
. We didn't have a test for custom children which is why this breakage slipped through.
Would a fallback logic on findDOMNode work? Is it possible to detect if the provided element doesn't accept a ref?
Can we detect if the provided element doesn't accept a ref?
Unfortunately not. We can only look at the direct element and in cases of React.memo we don't know if a ref can be held because it could wrap a function component.
Would a fallback logic on findDOMNode work?
We could convert Snackbar to a class component and then fallback to findDOMNode(this)
. But it would still create warnings that we attached a ref to function components. This is a pretty big drawback because that particular warning is an actual error for every other material-ui component. If we communicate that it can be ignored for Snackbars it might be ignored in other cases.
Still have the error on the demo page btw.
@klein-h We don't automatically release merged PRs.
for now use v4.0.0 that is working for me
for now use v4.0.0 that is working for me
4.1.1 should be good too.
for now use v4.0.0 that is working for me
4.1.1 should be good too.
Downgrading to 4.1.1 not fixing the problem....
even tried 4.0.2
"@material-ui/core": "^4.1.1",
"@material-ui/icons": "^4.2.1",
"@material-ui/lab": "^4.0.0-alpha.17",
"@material-ui/styles": "^4.1.2",
"@mdi/font": "^3.7.95",
"@mdi/js": "^3.7.95",
"@mdi/react": "^1.1.1",
I got the same error with version 4.1.1
It works well on my development but not in production.
I had tried v4.1.2 and v4.1.1 and It was not working. It is working well for me on v4.1.0
If it's not working on 4.1.1 or before please open a new issue and follow the template. The reproduction from https://github.com/mui-org/material-ui/issues/16347#issuecomment-504877635 does not crash with 4.1.1
Issue fixed, working in 4.1.3
Most helpful comment
I had tried v4.1.2 and v4.1.1 and It was not working. It is working well for me on v4.1.0