-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Snackbar - TypeError: Cannot read property 'scrollTop' of undefined #16347
Comments
Confirmed reproduction: https://codesandbox.io/embed/y6lzd Opened success snackbar and got the type error. |
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. |
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 |
#16283 was a breaking for Snackbars. We need to revert. |
Would a fallback logic on findDOMNode work? Is it possible to 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.
We could convert Snackbar to a class component and then fallback to |
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 |
4.1.1 should be good too. |
Downgrading to 4.1.1 not fixing the problem....
|
I got the same error with version 4.1.1 |
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 #16347 (comment) does not crash with 4.1.1 |
Issue fixed, working in 4.1.3 |
@material-ui/core: 4.1.2
Re-produce: use react material live site & CodeSandbox demo.
The text was updated successfully, but these errors were encountered: