Skip to content

Commit 11b098d

Browse files
authored
feat: ensure highlighted comment is visible (#4034)
1 parent c605869 commit 11b098d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/pages/common/CommentsV2/CommentSectionV2.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ const CommentSectionV2 = ({ sourceId }: CommentsV2Props) => {
6060
highlightedReply.highlighted = true
6161
}
6262
}
63+
64+
// ensure highlighted comment is visible
65+
const index = comments.findIndex(
66+
(x) => x.highlighted || x.replies?.some((y) => y.highlighted),
67+
)
68+
69+
if (index > 5) {
70+
setCommentLimit(index + 1)
71+
}
6372
}
6473

6574
setComments(comments || [])

0 commit comments

Comments
 (0)