This commit is contained in:
saltrafael 2021-06-21 11:06:16 -03:00
parent 52f15df5a3
commit 2fcc57dbba

View file

@ -84,8 +84,8 @@ export default function LivestreamComments(props: Props) {
function handleScroll() {
if (discussionElement) {
const negativeCommentHeight = (-1 * commentElement.offsetHeight);
const isAtRecent = discussionElement.scrollTop >= negativeCommentHeight;
const negativeCommentHeight = commentElement && (-1 * commentElement.offsetHeight);
const isAtRecent = negativeCommentHeight && (discussionElement.scrollTop >= negativeCommentHeight);
setScrollBottom(isAtRecent);
}