New experimental dynamic routing breaks zone support
See original GitHub issueBug report
When using experimental dynamic routes (#7432) in a zoned app. I get this error in the browser:
Your `<Link>`'s `as` value is incompatible with the `href` value. This is invalid
Describe the bug
In order to find the query parameters, href and as are matched against each other. But the current implementation seems to be too strict.
To Reproduce
See https://github.com/Xiphe/next-dynamic-route-in-zone
- Create a next app
- Add a proxy to have it mounted on a subpath (like
http://localhost:3000/foo) - Add a index page and a dynamic page (like
pages/bar/$dyn.js) - Try to link to the dynamic page from the index page
<Link href="/bar/$dyn" as "/foo/bar/baz"><a>Baz</a></Link> - Click the link in the browser
Expected behavior
I want to use dynamic routes in a zoned app, so the above Link-code should not throw.
System information
- OS: macOS
- Browser: chrome
- Version of Next.js: 8.1.1-canary.43
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:24 (11 by maintainers)
Top Results From Across the Web
Dynamic routing with Cloud Router | Google Cloud - Community
On Google Cloud, dynamic routing can be established using Cloud Router. It exchanges network topology information through Border Gateway ...
Read more >Dynamic Routing - an overview | ScienceDirect Topics
The dynamic routing algorithm is the algorithm that produces the outputs. This is done both during training and during testing, given the values...
Read more >What's new in Angular 14? - Ninja Squad
Route providers, standalone routes, loadComponent. A bunch of new things have been added to the router to support the new standalone APIs. For ......
Read more >Dynamic Vehicle Routing Problem—Predictive and ... - MDPI
The authors consider the breakdown of vehicles and the need to create a new schedule by minimizing transportation costs and deviations from the...
Read more >Advanced Features: Next.js Compiler
v12.2.0, SWC Plugins experimental support added. ... __generated__ directory, and this file will be considered a route, which will break production builds.
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 Free
Top 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

If you do not want to incorporate the zone name into your pages directory then you can use the following monkey patch to work around this issue (Note: I store the zone/base path in the next public runtime config but you can hardcode it):
I’m glad that @Xiphe came to a conclusion for their personal project, but downstream dependencies like
next-i18nextneed to be able to insert subpaths without making modifications to the filesystem.See https://github.com/isaachinman/next-i18next/issues/413.
Can we reopen this issue?