fix(admin-ui): split /dictionaries into layout + index for nested route
После regen routeTree.gen.ts /dictionaries/$name стал child route /dictionaries.
dictionaries.tsx рендерил карточки без <Outlet/> — клик по карточке менял URL,
но child компонент негде было рендерить, поэтому видна та же страница со списком.
Разнёс по конвенции:
- dictionaries.tsx — layout с <Outlet/>
- dictionaries.index.tsx — карточки списка (matches /dictionaries)
- dictionaries.$name.tsx — без изменений (matches /dictionaries/{name})
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as DictionariesRouteImport } from './routes/dictionaries'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as DictionariesIndexRouteImport } from './routes/dictionaries.index'
|
||||
import { Route as DictionariesNameRouteImport } from './routes/dictionaries.$name'
|
||||
|
||||
const DictionariesRoute = DictionariesRouteImport.update({
|
||||
@@ -23,6 +24,11 @@ const IndexRoute = IndexRouteImport.update({
|
||||
path: '/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const DictionariesIndexRoute = DictionariesIndexRouteImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => DictionariesRoute,
|
||||
} as any)
|
||||
const DictionariesNameRoute = DictionariesNameRouteImport.update({
|
||||
id: '/$name',
|
||||
path: '/$name',
|
||||
@@ -33,24 +39,31 @@ export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/dictionaries': typeof DictionariesRouteWithChildren
|
||||
'/dictionaries/$name': typeof DictionariesNameRoute
|
||||
'/dictionaries/': typeof DictionariesIndexRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/dictionaries': typeof DictionariesRouteWithChildren
|
||||
'/dictionaries/$name': typeof DictionariesNameRoute
|
||||
'/dictionaries': typeof DictionariesIndexRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
'/': typeof IndexRoute
|
||||
'/dictionaries': typeof DictionariesRouteWithChildren
|
||||
'/dictionaries/$name': typeof DictionariesNameRoute
|
||||
'/dictionaries/': typeof DictionariesIndexRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths: '/' | '/dictionaries' | '/dictionaries/$name'
|
||||
fullPaths: '/' | '/dictionaries' | '/dictionaries/$name' | '/dictionaries/'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to: '/' | '/dictionaries' | '/dictionaries/$name'
|
||||
id: '__root__' | '/' | '/dictionaries' | '/dictionaries/$name'
|
||||
to: '/' | '/dictionaries/$name' | '/dictionaries'
|
||||
id:
|
||||
| '__root__'
|
||||
| '/'
|
||||
| '/dictionaries'
|
||||
| '/dictionaries/$name'
|
||||
| '/dictionaries/'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
@@ -74,6 +87,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof IndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/dictionaries/': {
|
||||
id: '/dictionaries/'
|
||||
path: '/'
|
||||
fullPath: '/dictionaries/'
|
||||
preLoaderRoute: typeof DictionariesIndexRouteImport
|
||||
parentRoute: typeof DictionariesRoute
|
||||
}
|
||||
'/dictionaries/$name': {
|
||||
id: '/dictionaries/$name'
|
||||
path: '/$name'
|
||||
@@ -86,10 +106,12 @@ declare module '@tanstack/react-router' {
|
||||
|
||||
interface DictionariesRouteChildren {
|
||||
DictionariesNameRoute: typeof DictionariesNameRoute
|
||||
DictionariesIndexRoute: typeof DictionariesIndexRoute
|
||||
}
|
||||
|
||||
const DictionariesRouteChildren: DictionariesRouteChildren = {
|
||||
DictionariesNameRoute: DictionariesNameRoute,
|
||||
DictionariesIndexRoute: DictionariesIndexRoute,
|
||||
}
|
||||
|
||||
const DictionariesRouteWithChildren = DictionariesRoute._addFileChildren(
|
||||
|
||||
Reference in New Issue
Block a user