TanStackT
TanStack4mo ago
40 replies
urgent-maroon

Tanstack routeTree generation multi-layout issues

For my react app's build process, i need to use tanstack router cli's route generation before building. Big problem is that I'm running into conflicting layout.tsx. What really confuses me is that it generates the routeTree just fine during dev, but once I try to use the CLI it flips out.

Error: Conflicting configuration paths were found for the following routes: "/", "/", "/", "/events/$eventId/dashboard/", "/events/$eventId/dashboard/", ...
Please ensure each Route has a unique full path.
Conflicting files:
- src/routes/index.tsx
- src/routes/(protected)/_layout.tsx
- src/routes/(protected)/(user)/_layout.tsx
- src/routes/(protected)/events/$eventId/dashboard/index.tsx
- src/routes/(protected)/events/$eventId/dashboard/(staff)/_layout.tsx
- src/routes/(protected)/events/$eventId/dashboard/(attendee)/_layout.tsx
- src/routes/(protected)/events/$eventId/dashboard/(applicant)/_layout.tsx
- src/routes/(protected)/events/$eventId/dashboard/(admin)/_layout.tsx


For some context, the dashboard layout.tsx is the UI wrapper (app shell) while each (admin), (attendee), etc is more so an auth guard.

It seems like (protected)/layout.tsx also conflicts with (protected)/(user)/_layout.tsx as well. (protected) handles auth guard, (user) handles app shell, again.

Most of these pathless folders are for dev organization.

Anyone have any solutions? I was thinking possibly deleting the (protected) layout and just moving the authguard inside of (user).

And for the (admin) and dashboard conflict, maybe just have a dedicated auth guard for each file inside, although that is a LOT of copy pasting and isn't very DRY...
Was this page helpful?