Closed javismiles closed 3 years ago
👋 Thanks for using Material-UI!
We use GitHub issues exclusively as a bug and feature requests tracker, however, this issue appears to be a support request.
For support, please check out https://material-ui.com/getting-started/support/. Thanks!
If you have a question on StackOverflow, you are welcome to link to it here, it might help others. If your issue is subsequently confirmed as a bug, and the report follows the issue template, it can be reopened.
@oliviertassinari Thank you, I switched to normal ref yes, the main issue seems to be that componentDidUpdate() is not firing after render of the material-ui list is completed, but before. I can prove this by using plain javascript: var scrollPos= document.getElementsByClassName("MuiDialog-paper"); This returns undefined after componentDidUpdate fires. Yet it returns the correct value later on after a few seconds. It seems to me that componentDidUpdate is firing incorrectly in conjuntion with this material-ui component thank you
This is the way I made it work
componentDidUpdate() {
setTimeout(function(){
var scrollPos= document.getElementsByClassName("MuiDialog-paper");
if (scrollPos.length>0){scrollPos[0].scrollTop=0;}
}, 200);
}
certainly a very absurd way, but the only way I found. Seems like the rendering of the list goes beyond useEffect, componentDidUpdate etc firings, so the only way is to wait x time to then check things out, etc
It would be great if the documentation maybe provided some suggestion to detect the full completed rendering of material-ui components such as List, etc
thank you