fix(Comment): Remove scroll to top when changing comment sort order. (#2566)

This commit is contained in:
Bryan Mutai 2025-09-22 20:50:44 +03:00 committed by GitHub
parent 256cb794a1
commit 3b8840c731
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,6 @@ import { UNKNOWN_LINK_REL } from '@/lib/constants'
import classNames from 'classnames'
import { CarouselProvider } from './carousel'
import Embed from './embed'
import { useRouter } from 'next/router'
import useCommentsView from './use-comments-view'
function BioItem ({ item, handleClick }) {
@ -169,9 +168,6 @@ export default function ItemFull ({ item, fetchMoreComments, bio, rank, ...props
markItemViewed(item)
}, [item.id, markItemViewed])
const router = useRouter()
const carouselKey = `${item.id}-${router.query?.sort || 'default'}`
return (
<>
{rank
@ -181,7 +177,7 @@ export default function ItemFull ({ item, fetchMoreComments, bio, rank, ...props
</div>)
: <div />}
<RootProvider root={item.root || item}>
<CarouselProvider key={carouselKey}>
<CarouselProvider key={item.id}>
{item.parentId
? <Comment topLevel item={item} replyOpen includeParent noComments {...props} />
: (