TanStackT
TanStack12mo ago
25 replies
worthy-azure

How do I use Non-Nested Routes in File-based router?

I'm building an application where we want to keep a lot of information as path params.
Mostly there is no route nesting. All of the routes are supposed to render directly after our auth layout.

While we are at 1 level of nesting everything was working well with the _ suffix.
E.g. _auth/accounts_/$accountId/projects works well.
The issue begins when I want to render with even more nesting.
e.g. _auth/accounts_/$accountId/projects_/$projectId
I've tried various variations of where to place suffixes but it never ends up working, and I havne't been able to find multiple suffix example on the docs.

Visiting the above mentioned page projectId page throws:
Invariant failed: Could not find an active match from "/_auth/projects/$projectId"


My folder structure is: <image>

With rest of protected routes inside of the _auth folder.
image.png
Was this page helpful?