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:
2026-07-18 22:42:45 -04:00
co-authored by Claude Opus 4.8
parent cee27a6189
commit 9d5b11bb10
4 changed files with 91 additions and 58 deletions
@@ -15,6 +15,12 @@ import { toast } from "sonner";
export const Route = createFileRoute("/_authenticated/students/new")({
head: () => ({ meta: [{ title: "New student — School Portal" }] }),
component: NewStudentPage,
errorComponent: ({ error }) => (
<div className="p-8 max-w-2xl">
<h1 className="text-lg font-semibold text-destructive">This page hit an error</h1>
<pre className="mt-3 whitespace-pre-wrap break-words text-xs bg-muted p-3 rounded border">{error?.message}{"\n\n"}{error?.stack}</pre>
</div>
),
});
type Guardian = {