don't add scroll listener until comments have been fetched
This commit is contained in:
parent
00c05437ca
commit
fc2a79242e
1 changed files with 2 additions and 2 deletions
|
@ -111,14 +111,14 @@ function CommentList(props: Props) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moreBelow && spinnerRef && spinnerRef.current) {
|
if (!isFetchingComments && moreBelow && spinnerRef && spinnerRef.current) {
|
||||||
window.addEventListener('scroll', handleCommentScroll);
|
window.addEventListener('scroll', handleCommentScroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => window.removeEventListener('scroll', handleCommentScroll);
|
return () => window.removeEventListener('scroll', handleCommentScroll);
|
||||||
}, [moreBelow, handleMoreBelow, spinnerRef]);
|
}, [moreBelow, handleMoreBelow, spinnerRef]);
|
||||||
|
|
||||||
function prepareComments(arrayOfComments, linkedComment) {
|
function prepareComments(arrayOfComments, linkedComment, isFetchingComments) {
|
||||||
let orderedComments = [];
|
let orderedComments = [];
|
||||||
|
|
||||||
if (linkedComment) {
|
if (linkedComment) {
|
||||||
|
|
Loading…
Reference in a new issue