mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
In `Link`, `router.push`, and `router.replace`, `as` option used to throw for optional catch all routes with url object syntax: optional attribute were not taken into account when checking missing parameters in router change method. This PR just add a condition in the filter callback to filter out optional routes. Fixes #41624 ## Bug - [X] Related issues linked using `fixes #number` - [X] Integration tests added - [X] Errors have a helpful link attached, see `contributing.md`
23 lines
470 B
JavaScript
23 lines
470 B
JavaScript
import Link from 'next/link'
|
|
import { useRouter } from 'next/router'
|
|
|
|
export default function News() {
|
|
const { asPath, pathname, query } = useRouter()
|
|
|
|
return (
|
|
<div>
|
|
<h1 id="news">news page</h1>
|
|
<p id="asPath">{asPath}</p>
|
|
<p id="pathname">{pathname}</p>
|
|
<p id="query">{JSON.stringify(query)}</p>
|
|
<Link href="/">← Back home</Link>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export async function getServerSideProps() {
|
|
return {
|
|
props: {},
|
|
}
|
|
}
|