From fc2a79242e0e4724fde8b250dd2ae38375f9865e Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 6 Oct 2020 16:13:42 -0400 Subject: [PATCH] don't add scroll listener until comments have been fetched --- 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 bf0824b7b..6a8ef9556 100644 --- a/ui/component/commentsList/view.jsx +++ b/ui/component/commentsList/view.jsx @@ -111,14 +111,14 @@ function CommentList(props: Props) { } } - if (moreBelow && spinnerRef && spinnerRef.current) { + if (!isFetchingComments && moreBelow && spinnerRef && spinnerRef.current) { window.addEventListener('scroll', handleCommentScroll); } return () => window.removeEventListener('scroll', handleCommentScroll); }, [moreBelow, handleMoreBelow, spinnerRef]); - function prepareComments(arrayOfComments, linkedComment) { + function prepareComments(arrayOfComments, linkedComment, isFetchingComments) { let orderedComments = []; if (linkedComment) {