wait to scroll to linked comments until readyToDisplay=true

This commit is contained in:
Sean Yesmunt 2020-10-08 13:01:33 -04:00
parent 6d4a92ad27
commit 480d8a8786

View file

@ -85,11 +85,11 @@ function CommentList(props: Props) {
}, [fetchReacts, uri, totalComments, activeChannel, fetchingChannels]);
useEffect(() => {
if (linkedCommentId && commentRef && commentRef.current) {
if (readyToDisplayComments && linkedCommentId && commentRef && commentRef.current) {
commentRef.current.scrollIntoView({ block: 'start' });
window.scrollBy(0, -100);
}
}, [linkedCommentId]);
}, [readyToDisplayComments, linkedCommentId]);
useEffect(() => {
function handleCommentScroll(e) {