fix(Comment): Remove scroll to top when changing comment sort order. (#2566)
This commit is contained in:
parent
256cb794a1
commit
3b8840c731
@ -25,7 +25,6 @@ import { UNKNOWN_LINK_REL } from '@/lib/constants'
|
|||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import { CarouselProvider } from './carousel'
|
import { CarouselProvider } from './carousel'
|
||||||
import Embed from './embed'
|
import Embed from './embed'
|
||||||
import { useRouter } from 'next/router'
|
|
||||||
import useCommentsView from './use-comments-view'
|
import useCommentsView from './use-comments-view'
|
||||||
|
|
||||||
function BioItem ({ item, handleClick }) {
|
function BioItem ({ item, handleClick }) {
|
||||||
@ -169,9 +168,6 @@ export default function ItemFull ({ item, fetchMoreComments, bio, rank, ...props
|
|||||||
markItemViewed(item)
|
markItemViewed(item)
|
||||||
}, [item.id, markItemViewed])
|
}, [item.id, markItemViewed])
|
||||||
|
|
||||||
const router = useRouter()
|
|
||||||
const carouselKey = `${item.id}-${router.query?.sort || 'default'}`
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{rank
|
{rank
|
||||||
@ -181,7 +177,7 @@ export default function ItemFull ({ item, fetchMoreComments, bio, rank, ...props
|
|||||||
</div>)
|
</div>)
|
||||||
: <div />}
|
: <div />}
|
||||||
<RootProvider root={item.root || item}>
|
<RootProvider root={item.root || item}>
|
||||||
<CarouselProvider key={carouselKey}>
|
<CarouselProvider key={item.id}>
|
||||||
{item.parentId
|
{item.parentId
|
||||||
? <Comment topLevel item={item} replyOpen includeParent noComments {...props} />
|
? <Comment topLevel item={item} replyOpen includeParent noComments {...props} />
|
||||||
: (
|
: (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user