Using parallel or intercepting routes to render a modal on a catch-all route #50967
Unanswered
Doesntmeananything
asked this question in
App Router
Replies: 1 comment
-
|
@Doesntmeananything were you able to find a solution? I resolved it in my project by adding a parallel route as a sibling to the catch-all route, and putting the intercepting route in there. As a side effect, the intercepting route has to apply to everything under the catch-all route, but that's okay in my case. I'm not sure what could be done about that otherwise... Maybe, in the layout, you could conditionally render the parallel route based on the URL? ...Not pretty, but it's working for me. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to use parallel or intercepting routes when implementing a modal on a catch-all route?
My use case is the following:
/root/branch-1/leaf-1/edit, where/editis the last segment used for rendering the modal.I've looked at the docs for Parallel routes and Intercepting routes and tried to add this behaviour to the app, however I get a build error:
Conceptually, I understand why it's not possible to use parallel and intercepting routes for modals like this, since catch-all routes assume they're going to be handling all the route segments at their level and below. But I may also be missing something, e.g. it may be possible to intercept the last segment of a catch-all route and use it to drive modal state.
For now, it seems that my only option for URL-driven modals is to use search parameters.
Beta Was this translation helpful? Give feedback.
All reactions