fix url UX exposing state
This commit is contained in:
parent
43a54d407e
commit
7589295e8c
|
@ -68,12 +68,15 @@ export default function Comments ({ parentId, pinned, bio, parentCreatedAt, comm
|
|||
? <CommentsHeader
|
||||
commentSats={commentSats} parentCreatedAt={parentCreatedAt}
|
||||
pinned={pinned} bio={bio} handleSort={sort => {
|
||||
const query = router.query
|
||||
const { commentsViewedAt, commentId, ...query } = router.query
|
||||
delete query.nodata
|
||||
router.push({
|
||||
pathname: router.pathname,
|
||||
query: { ...router.query, sort }
|
||||
}, undefined, { scroll: false })
|
||||
query: { ...query, commentsViewedAt, sort }
|
||||
}, {
|
||||
pathname: `/items/${parentId}`,
|
||||
query: sort === defaultCommentSort(pinned, bio, parentCreatedAt) ? undefined : { sort }
|
||||
}, { scroll: false })
|
||||
}}
|
||||
/>
|
||||
: null}
|
||||
|
|
|
@ -59,7 +59,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
|
|||
e.preventDefault()
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
window.open(
|
||||
`/items/${item.id}?commentsViewedAt=${viewedAt}`,
|
||||
`/items/${item.id}`,
|
||||
'_blank',
|
||||
'noopener,noreferrer'
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue