diff --git a/app/scenes/Document/components/CommentThread.tsx b/app/scenes/Document/components/CommentThread.tsx index 0ba1dae92e..737234483d 100644 --- a/app/scenes/Document/components/CommentThread.tsx +++ b/app/scenes/Document/components/CommentThread.tsx @@ -54,7 +54,7 @@ function CommentThread({ collapseThreshold = 5, collapseNumDisplayed = 3, }: Props) { - const [focusedOnMount] = React.useState(focused); + const [scrollOnMount] = React.useState(focused && !window.location.hash); const { editor } = useDocumentContext(); const { comments } = useStores(); const topRef = React.useRef(null); @@ -165,7 +165,7 @@ function CommentThread({ React.useEffect(() => { if (focused) { - if (focusedOnMount) { + if (scrollOnMount) { setTimeout(() => { if (!topRef.current) { return; @@ -209,7 +209,7 @@ function CommentThread({ isMarkVisible ? 0 : sidebarAppearDuration ); } - }, [focused, focusedOnMount, thread.id]); + }, [focused, scrollOnMount, thread.id]); return (