Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,20 @@ export async function getRouteNodes(
originalRoutePath = '/'
}

// For layout routes, don't use '/' fallback - an empty path means
// "layout for the parent path" which is important for physical() mounts
// where route.tsx at root should have empty path, not '/'
const isLayoutRoute = routeType === 'layout'

routePath =
routePath.replace(new RegExp(`/${config.indexToken}$`), '/') ||
'/'
(isLayoutRoute ? '' : '/')

originalRoutePath =
originalRoutePath.replace(
new RegExp(`/${config.indexToken}$`),
'/',
) || '/'
) || (isLayoutRoute ? '' : '/')
}

routeNodes.push({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/* eslint-disable */

// @ts-nocheck

// noinspection JSUnusedGlobalSymbols

// This file was automatically generated by TanStack Router.
// You should NOT make any changes in this file as it will be overwritten.
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.

import { Route as rootRouteImport } from './routes/__root'
import { Route as FeatureRouteRouteImport } from './routes/feature/route'
import { Route as IndexRouteImport } from './routes/index'
import { Route as FeatureIndexRouteImport } from './routes/feature/index'

const FeatureRouteRoute = FeatureRouteRouteImport.update({
id: '/feature',
path: '/feature',
getParentRoute: () => rootRouteImport,
} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const FeatureIndexRoute = FeatureIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => FeatureRouteRoute,
} as any)

export interface FileRoutesByFullPath {
'/': typeof IndexRoute
'/feature': typeof FeatureRouteRouteWithChildren
'/feature/': typeof FeatureIndexRoute
}
export interface FileRoutesByTo {
'/': typeof IndexRoute
'/feature': typeof FeatureIndexRoute
}
export interface FileRoutesById {
__root__: typeof rootRouteImport
'/': typeof IndexRoute
'/feature': typeof FeatureRouteRouteWithChildren
'/feature/': typeof FeatureIndexRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: '/' | '/feature' | '/feature/'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/feature'
id: '__root__' | '/' | '/feature' | '/feature/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
FeatureRouteRoute: typeof FeatureRouteRouteWithChildren
}

declare module '@tanstack/react-router' {
interface FileRoutesByPath {
'/feature': {
id: '/feature'
path: '/feature'
fullPath: '/feature'
preLoaderRoute: typeof FeatureRouteRouteImport
parentRoute: typeof rootRouteImport
}
'/': {
id: '/'
path: '/'
fullPath: '/'
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/feature/': {
id: '/feature/'
path: '/'
fullPath: '/feature/'
preLoaderRoute: typeof FeatureIndexRouteImport
parentRoute: typeof FeatureRouteRoute
}
}
}

interface FeatureRouteRouteChildren {
FeatureIndexRoute: typeof FeatureIndexRoute
}

const FeatureRouteRouteChildren: FeatureRouteRouteChildren = {
FeatureIndexRoute: FeatureIndexRoute,
}

const FeatureRouteRouteWithChildren = FeatureRouteRoute._addFileChildren(
FeatureRouteRouteChildren,
)

const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
FeatureRouteRoute: FeatureRouteRouteWithChildren,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { index, physical, rootRoute } from '@tanstack/virtual-file-routes'

export const routes = rootRoute('__root.tsx', [
index('index.tsx'),
physical('/feature', 'feature'),
])
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createRootRoute, Outlet } from '@tanstack/react-router'

export const Route = createRootRoute({
component: () => <Outlet />,
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createFileRoute } from '@tanstack/react-router'

export const Route = createFileRoute('/feature/')({
component: () => <div>Feature Index</div>,
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createFileRoute, Outlet } from '@tanstack/react-router'

export const Route = createFileRoute('/feature')({
component: () => (
<div>
<h1>Feature Layout</h1>
<Outlet />
</div>
),
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createFileRoute } from '@tanstack/react-router'

export const Route = createFileRoute('/')({
component: () => <div>Home</div>,
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"routesDirectory": "./routes",
"generatedRouteTree": "./routeTree.gen.ts",
"virtualRouteConfig": "./routes.ts"
}
Loading