Skip to content
Source
Sign inSign up
TanStack/router

Duplicate virtual route generation with nested layout routes #2360

Send to my agent
ClosedSpaubleit(GitHub profile, opens in a new tab) opened this issue 0 comments

Which project does this relate to?

Router

Describe the bug

I have simplified file structure like this: Image In a real application each directory contains additional routes.

As you can see I don't have duplicated file routes. But after generation I get duplicated routes in routeTree.gen.ts:

// Create Virtual Routes

const ProtectedSystemsSysIdImport = createFileRoute(
  '/_protected/systems/$sysId',
)()
const ProtectedSystemsSysIdSysLayoutEditImport = createFileRoute(
  '/_protected/systems/$sysId/_sys-layout/edit',
)()

Why is ProtectedSystemsSysIdImport being created when I already have _public/systems.$sysId.tsx? Is it possible to restructure my code to fix this issue or is this a problem in generator?

Your Example Website or App

https://stackblitz.com/edit/vitejs-vite-6ambir

Steps to Reproduce the Bug or Issue

  1. npm run dev

Expected behavior

I expect to get valid route tree when there are no conflicting route files in the application.

Screenshots or Videos

No response

Platform

  • OS: Linux
  • Browser: Firefox
  • Version: 129.0

Additional context

No response

Sign in to join this conversation.