fix scroll issue on upvote after click to context

This commit is contained in:
keyan 2021-12-21 12:14:48 -06:00
parent ad705d9165
commit f6b1da64f9
1 changed files with 4 additions and 0 deletions

View File

@ -60,6 +60,10 @@ export default function Comment ({
if (Number(router.query.commentId) === Number(item.id)) {
ref.current.scrollIntoView()
ref.current.classList.add('flash-it')
router.replace({
pathname: router.pathname,
query: { id: router.query.id }
}, undefined, { scroll: false })
}
setCollapse(localStorage.getItem(`commentCollapse:${item.id}`))
}, [item])