Fix blank /students/new and /students/$id (missing Outlet)
students.tsx was the list AND the parent of students.new / students.$id but rendered no <Outlet/>, so child routes never showed. Make students.tsx an Outlet layout and move the list to students.index.tsx. Add an errorComponent to students.new as a safety net. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+22
-2
@@ -20,6 +20,7 @@ import { Route as AuthenticatedDashboardRouteImport } from './routes/_authentica
|
||||
import { Route as AuthenticatedCalendarRouteImport } from './routes/_authenticated/calendar'
|
||||
import { Route as AuthenticatedAttendanceRouteImport } from './routes/_authenticated/attendance'
|
||||
import { Route as AuthenticatedAdminRouteImport } from './routes/_authenticated/admin'
|
||||
import { Route as AuthenticatedStudentsIndexRouteImport } from './routes/_authenticated/students.index'
|
||||
import { Route as AuthenticatedStudentsNewRouteImport } from './routes/_authenticated/students.new'
|
||||
import { Route as AuthenticatedStudentsIdRouteImport } from './routes/_authenticated/students.$id'
|
||||
|
||||
@@ -77,6 +78,12 @@ const AuthenticatedAdminRoute = AuthenticatedAdminRouteImport.update({
|
||||
path: '/admin',
|
||||
getParentRoute: () => AuthenticatedRouteRoute,
|
||||
} as any)
|
||||
const AuthenticatedStudentsIndexRoute =
|
||||
AuthenticatedStudentsIndexRouteImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => AuthenticatedStudentsRoute,
|
||||
} as any)
|
||||
const AuthenticatedStudentsNewRoute =
|
||||
AuthenticatedStudentsNewRouteImport.update({
|
||||
id: '/new',
|
||||
@@ -102,6 +109,7 @@ export interface FileRoutesByFullPath {
|
||||
'/students': typeof AuthenticatedStudentsRouteWithChildren
|
||||
'/students/$id': typeof AuthenticatedStudentsIdRoute
|
||||
'/students/new': typeof AuthenticatedStudentsNewRoute
|
||||
'/students/': typeof AuthenticatedStudentsIndexRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
@@ -113,9 +121,9 @@ export interface FileRoutesByTo {
|
||||
'/forms': typeof AuthenticatedFormsRoute
|
||||
'/ledger': typeof AuthenticatedLedgerRoute
|
||||
'/messages': typeof AuthenticatedMessagesRoute
|
||||
'/students': typeof AuthenticatedStudentsRouteWithChildren
|
||||
'/students/$id': typeof AuthenticatedStudentsIdRoute
|
||||
'/students/new': typeof AuthenticatedStudentsNewRoute
|
||||
'/students': typeof AuthenticatedStudentsIndexRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
@@ -132,6 +140,7 @@ export interface FileRoutesById {
|
||||
'/_authenticated/students': typeof AuthenticatedStudentsRouteWithChildren
|
||||
'/_authenticated/students/$id': typeof AuthenticatedStudentsIdRoute
|
||||
'/_authenticated/students/new': typeof AuthenticatedStudentsNewRoute
|
||||
'/_authenticated/students/': typeof AuthenticatedStudentsIndexRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
@@ -148,6 +157,7 @@ export interface FileRouteTypes {
|
||||
| '/students'
|
||||
| '/students/$id'
|
||||
| '/students/new'
|
||||
| '/students/'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to:
|
||||
| '/'
|
||||
@@ -159,9 +169,9 @@ export interface FileRouteTypes {
|
||||
| '/forms'
|
||||
| '/ledger'
|
||||
| '/messages'
|
||||
| '/students'
|
||||
| '/students/$id'
|
||||
| '/students/new'
|
||||
| '/students'
|
||||
id:
|
||||
| '__root__'
|
||||
| '/'
|
||||
@@ -177,6 +187,7 @@ export interface FileRouteTypes {
|
||||
| '/_authenticated/students'
|
||||
| '/_authenticated/students/$id'
|
||||
| '/_authenticated/students/new'
|
||||
| '/_authenticated/students/'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
@@ -264,6 +275,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof AuthenticatedAdminRouteImport
|
||||
parentRoute: typeof AuthenticatedRouteRoute
|
||||
}
|
||||
'/_authenticated/students/': {
|
||||
id: '/_authenticated/students/'
|
||||
path: '/'
|
||||
fullPath: '/students/'
|
||||
preLoaderRoute: typeof AuthenticatedStudentsIndexRouteImport
|
||||
parentRoute: typeof AuthenticatedStudentsRoute
|
||||
}
|
||||
'/_authenticated/students/new': {
|
||||
id: '/_authenticated/students/new'
|
||||
path: '/new'
|
||||
@@ -284,11 +302,13 @@ declare module '@tanstack/react-router' {
|
||||
interface AuthenticatedStudentsRouteChildren {
|
||||
AuthenticatedStudentsIdRoute: typeof AuthenticatedStudentsIdRoute
|
||||
AuthenticatedStudentsNewRoute: typeof AuthenticatedStudentsNewRoute
|
||||
AuthenticatedStudentsIndexRoute: typeof AuthenticatedStudentsIndexRoute
|
||||
}
|
||||
|
||||
const AuthenticatedStudentsRouteChildren: AuthenticatedStudentsRouteChildren = {
|
||||
AuthenticatedStudentsIdRoute: AuthenticatedStudentsIdRoute,
|
||||
AuthenticatedStudentsNewRoute: AuthenticatedStudentsNewRoute,
|
||||
AuthenticatedStudentsIndexRoute: AuthenticatedStudentsIndexRoute,
|
||||
}
|
||||
|
||||
const AuthenticatedStudentsRouteWithChildren =
|
||||
|
||||
Reference in New Issue
Block a user