mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
56ad5121a1
Currently, using `as` will cause the router to think the URL is not changing in the case where you're re-rendering the same page with a different route. This would most likely be an issue for custom servers which are using shallow routing. This should be an invisible change for non-custom-server users, since `as` is defaulted to `url` if not set. This should resolve #3065.
18 lines
577 B
JavaScript
18 lines
577 B
JavaScript
import Link from 'next/link'
|
|
import {withRouter} from 'next/router'
|
|
|
|
export default withRouter(({router: {asPath, query}}) => {
|
|
return <div id={asPath.replace('/', '').replace('/', '-')}>
|
|
<div id='router-query'>{JSON.stringify(query)}</div>
|
|
<div>
|
|
<Link href='/nav/as-path-pushstate?something=hello' as='/something/hello'>
|
|
<a id='hello'>hello</a>
|
|
</Link>
|
|
</div>
|
|
|
|
{query.something === 'hello' && <Link href='/nav/as-path-pushstate?something=hello' as='/something/same-query'>
|
|
<a id='same-query'>same query</a>
|
|
</Link>}
|
|
</div>
|
|
})
|