Next.js Discord

Discord Forum

Parallel route not included in defined routes

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
Hello,

I am using the new AppRouter and I am having trouble including my parallel route as apart of my routes. Currently, I have a page called Finance, which includes a view page that I want to be able to display as its own page or as a parallel route in a modal somewhere else in my application. My goal is to be able to navigate to the "/finance/12345/view" route and be presented with the correct views and also be able to use the parallel as a prop in another route layout so that I can display the "/finance/12345/view" wrapped in a modal without having to change the full page.

This is my file structure:
app/ (/)
page.tsx
layout.tsx
loading.tsx
  finance/ (/finance)
    page.tsx
    loading.tsx
    [id]/
      @view/ (/finance/12345/view)
        page.tsx
        error.tsx
        loading.tsx


I was expecting the parallel route @view to be included in my routes, so if you navigate to "/finance/1245/view" it would display the correct page, loader, or error view, but this was not the result. I read the documentation, but believe I have missed something and am using parallel routes incorrectly. Does anyone have feedback on the mistake I am making and how to accomplish my goal?

Currently, I am thinking that I should seperate my finance view page into 3 presentational components (page, error, and loading) and reuse them that way.

0 Replies