-
-
Notifications
You must be signed in to change notification settings - Fork 794
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(router-generator): correctly generate route tree for nested route…
- Loading branch information
1 parent
6979e62
commit 1aa85ac
Showing
4 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/router-generator/tests/generator/route-groups/routeTree.snapshot.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* prettier-ignore-start */ | ||
|
||
/* eslint-disable */ | ||
|
||
// @ts-nocheck | ||
|
||
// noinspection JSUnusedGlobalSymbols | ||
|
||
// This file is auto-generated by TanStack Router | ||
|
||
// Import Routes | ||
|
||
import { Route as rootRoute } from './routes/__root' | ||
import { Route as fooAsdfbarIdImport } from './routes/(foo)/asdf/(bar)/$id' | ||
|
||
// Create/Update Routes | ||
|
||
const fooAsdfbarIdRoute = fooAsdfbarIdImport.update({ | ||
path: '/asdf/$id', | ||
getParentRoute: () => rootRoute, | ||
} as any) | ||
|
||
// Populate the FileRoutesByPath interface | ||
|
||
declare module '@tanstack/react-router' { | ||
interface FileRoutesByPath { | ||
'/(foo)/asdf/(bar)/$id': { | ||
id: '/asdf/$id' | ||
path: '/asdf/$id' | ||
fullPath: '/asdf/$id' | ||
preLoaderRoute: typeof fooAsdfbarIdImport | ||
parentRoute: typeof rootRoute | ||
} | ||
} | ||
} | ||
|
||
// Create and export the route tree | ||
|
||
export const routeTree = rootRoute.addChildren({ fooAsdfbarIdRoute }) | ||
|
||
/* prettier-ignore-end */ | ||
|
||
/* ROUTE_MANIFEST_START | ||
{ | ||
"routes": { | ||
"__root__": { | ||
"filePath": "__root.tsx", | ||
"children": [ | ||
"/asdf/$id" | ||
] | ||
}, | ||
"/asdf/$id": { | ||
"filePath": "(foo)/asdf/(bar)/$id.tsx" | ||
} | ||
} | ||
} | ||
ROUTE_MANIFEST_END */ |
5 changes: 5 additions & 0 deletions
5
packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(bar)/$id.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { createFileRoute } from '@tanstack/react-router' | ||
|
||
export const Route = createFileRoute('/(foo)/asdf/(bar)/$id')({ | ||
component: () => <div>Hello /(foo)/asdf/(bar)/$id!</div>, | ||
}) |
1 change: 1 addition & 0 deletions
1
packages/router-generator/tests/generator/route-groups/routes/__root.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/** */ |