-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix as option with optional catch all routes
`as` option used to throw with url object syntax: optional attribute were not taken into account when checking missing parameters in router change method. Fixes #41624
- Loading branch information
Showing
5 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
test/integration/rewrites-manual-href-as/pages/news/[[...slugs]].js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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: {}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters