Implementing a Parallel/Intercept route with a catch-all segment. #88957
Replies: 1 comment
|
I think this is mostly a route-shape limitation, not a missing config flag. Intercepting routes are matched by route segment depth. The So this: app/@modal/(.)[[...slug]]/page.tsxdoes not mean "open a modal for any URL whose slug contains For this kind of CMS route I would pick one of these approaches:
Also keep |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
Recently I wanted to implement an Intercept Route for a specific use case. To give context, I'm rendering content via Storyblok and to achieve this I use a catch-all segment
[[...slug]], because the slug could be of varying depth.What I wanted to implement is a way to render some specific slug containing
annexin the pathname inside a modal. Therefore I thought it would be cool to leverage what Next.js have for this.The
annexpathname could bexlevel deep would always be structured like this:.../annex/annex-1,.../annex/annex-2etcThe structure looked like the following:
But I believe I might have faced a limitation, because it was impossible for me to make this work. When I switched for a static route for exemple, it worked like I would expect it to work. But when I try to switch back to the catch-all segment, no modal render was being triggered.
Have you faced this yourself? Am I doing the implementation wrong? Is it a known limitation/bug? Do you have work-around?
Thank you!
All reactions