try url object with next/link to fix #822
This commit is contained in:
parent
2bbcbfbb26
commit
04991b4ddf
@ -217,8 +217,8 @@ function LurkerCorner ({ path }) {
|
||||
|
||||
const PREPEND_SUBS = ['home']
|
||||
const APPEND_SUBS = [{ label: '--------', items: ['create'] }]
|
||||
function NavItems ({ className, sub, prefix }) {
|
||||
sub ||= 'home'
|
||||
function NavItems ({ className, sub: subName, prefix }) {
|
||||
const sub = subName || 'home'
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -240,7 +240,12 @@ function NavItems ({ className, sub, prefix }) {
|
||||
</Nav.Item>
|
||||
{sub !== 'jobs' &&
|
||||
<Nav.Item className={className}>
|
||||
<Link href={prefix + '/top/posts/day'} passHref legacyBehavior>
|
||||
<Link
|
||||
href={{
|
||||
pathname: '/~/top/[type]/[when]',
|
||||
query: { type: 'posts', when: 'day', sub: subName }
|
||||
}} as={prefix + '/top/posts/day'} passHref legacyBehavior
|
||||
>
|
||||
<Nav.Link eventKey='top' className={styles.navLink}>top</Nav.Link>
|
||||
</Link>
|
||||
</Nav.Item>}
|
||||
|
@ -58,6 +58,12 @@ export default function MyApp ({ Component, pageProps: { ...props } }) {
|
||||
// this nodata var will get passed to the server on back/foward and
|
||||
// 1. prevent data from reloading and 2. perserve scroll
|
||||
// (2) is not possible while intercepting nav with beforePopState
|
||||
|
||||
console.log({
|
||||
pathname: router.pathname,
|
||||
query: { ...router.query, nodata: true }
|
||||
}, router.asPath, { ...router.options, shallow: true })
|
||||
|
||||
router.replace({
|
||||
pathname: router.pathname,
|
||||
query: { ...router.query, nodata: true }
|
||||
|
Loading…
x
Reference in New Issue
Block a user