From 0326e266d46ce756bd6f664fca19fcc2ff38cc24 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 6 Oct 2020 16:33:51 -0400 Subject: [PATCH] make sure comments are rendered before trying to render more --- ui/component/commentsList/view.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/component/commentsList/view.jsx b/ui/component/commentsList/view.jsx index 6a8ef9556..03513ef7f 100644 --- a/ui/component/commentsList/view.jsx +++ b/ui/component/commentsList/view.jsx @@ -111,12 +111,12 @@ function CommentList(props: Props) { } } - if (!isFetchingComments && moreBelow && spinnerRef && spinnerRef.current) { + if (!isFetchingComments && readyToDisplayComments && moreBelow && spinnerRef && spinnerRef.current) { window.addEventListener('scroll', handleCommentScroll); } return () => window.removeEventListener('scroll', handleCommentScroll); - }, [moreBelow, handleMoreBelow, spinnerRef]); + }, [moreBelow, handleMoreBelow, spinnerRef, isFetchingComments, readyToDisplayComments]); function prepareComments(arrayOfComments, linkedComment, isFetchingComments) { let orderedComments = [];