make sure comments are rendered before trying to render more
This commit is contained in:
parent
c1b5280446
commit
0326e266d4
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
window.addEventListener('scroll', handleCommentScroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => window.removeEventListener('scroll', handleCommentScroll);
|
return () => window.removeEventListener('scroll', handleCommentScroll);
|
||||||
}, [moreBelow, handleMoreBelow, spinnerRef]);
|
}, [moreBelow, handleMoreBelow, spinnerRef, isFetchingComments, readyToDisplayComments]);
|
||||||
|
|
||||||
function prepareComments(arrayOfComments, linkedComment, isFetchingComments) {
|
function prepareComments(arrayOfComments, linkedComment, isFetchingComments) {
|
||||||
let orderedComments = [];
|
let orderedComments = [];
|
||||||
|
|
Loading…
Reference in a new issue