feat: add smooth scroll to comment thread

This commit is contained in:
lyzno1 2025-10-11 12:08:20 +08:00
parent 2bce046278
commit 364be48248
No known key found for this signature in database
1 changed files with 6 additions and 2 deletions

View File

@ -205,8 +205,12 @@ export const CommentThread: FC<CommentThreadProps> = memo(({
const isNewComment = comment.id !== previousCommentIdRef.current
const hasNewReply = replies.length > previousReplyCountRef.current
if (isNewComment || hasNewReply)
container.scrollTop = container.scrollHeight
if (isNewComment || hasNewReply) {
container.scrollTo({
top: container.scrollHeight,
behavior: 'smooth',
})
}
previousCommentIdRef.current = comment.id
previousReplyCountRef.current = replies.length