diff --git a/src/client/routes/__root.tsx b/src/client/routes/__root.tsx index 71d9689..221a0fd 100644 --- a/src/client/routes/__root.tsx +++ b/src/client/routes/__root.tsx @@ -1,8 +1,10 @@ import { createRootRoute, + type ErrorComponentProps, Outlet, useMatchRoute, useNavigate, + useRouter, } from "@tanstack/react-router"; import { useState } from "react"; import "../app.css"; @@ -21,8 +23,53 @@ import { useUIStore } from "../stores/uiStore"; export const Route = createRootRoute({ component: RootLayout, + errorComponent: RootErrorBoundary, }); +function RootErrorBoundary({ error, reset }: ErrorComponentProps) { + const router = useRouter(); + + return ( +
+
+
+ + + +
+

+ Something went wrong +

+

+ {error instanceof Error + ? error.message + : "An unexpected error occurred"} +

+ +
+
+ ); +} + function RootLayout() { const navigate = useNavigate(); const { data: auth } = useAuth();