[9.5.3 - Rewrites] Navigating route with dynamic routes no longer work properly
See original GitHub issueDescribe the bug
// next.config.js
module.exports = {
rewrites() {
return [
{
source: "/my-post/:id",
destination: "/post"
}
];
}
};
Navigating via Link
or router.push
<Link
href={{
pathname: "/post",
query: {
id: 1,
another: "another"
}
}}
as="/my-post/1?another=another"
>
<a>Post 1</a>
</Link>
When custom the as
path with params
then router.query.id
no longer true.
Actual: id=1?another=another
Expected: id=1
To Reproduce
https://codesandbox.io/s/aged-sky-nzs6j?file=/pages/index.js
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Dynamic route not working on page refresh with Next.js
Since Next.js 9.5.3 there's no longer the need to use as for dynamic routes. Instead you can directly use the value to interpolate...
Read more >Client-Side Routing In Next.js - Smashing Magazine
This article will guide you through almost everything you need to know about Routing in Next.js and point you in the direction of...
Read more >next/router | Next.js
If cb returns false , the Next.js router will not handle popstate , and you'll be responsible for handling it in that case....
Read more >Migrating to React Router v6: A complete guide
Migrate your React Router applications from v5 to v6 with this in-depth guide, including a review of additions and improvements from v5.
Read more >Understanding Dynamic Routing Policies | Junos OS
The verification process required to commit configuration changes can entail a significant amount of overhead and time. For example, changing a prefix in ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nghiepit can you please try
next@9.5.4-canary.9
?@MrEfrem I opened a new issue to track the specific issue you are encountering here