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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ src/
│ ├── ui/ # shadcn/ui components (Button, Card, Input, Label)
│ ├── theme-provider.tsx # Dark/light/system theme context
│ ├── theme-toggle.tsx # Theme cycle button
│ ├── error-boundary.tsx # Root error component with retry
│ ├── error-boundary.tsx # Default error boundary with retry
│ └── not-found.tsx # 404 page
├── lib/
│ ├── analytics.tsx # AnalyticsProvider + useAnalytics hook
Expand Down
2 changes: 1 addition & 1 deletion src/components/error-boundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ErrorComponentProps } from "@tanstack/react-router"
import { Button } from "@/components/ui/button"
import { logger } from "@/lib/logger"

export function RootErrorComponent({ error, reset }: ErrorComponentProps) {
export function ErrorBoundary({ error, reset }: ErrorComponentProps) {
logger.error("Uncaught error in route component", {
message: error.message,
stack: error.stack,
Expand Down
4 changes: 4 additions & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { RouterProvider, createRouter } from "@tanstack/react-router"
import { StrictMode } from "react"
import { createRoot } from "react-dom/client"
import { toast } from "sonner"
import { ErrorBoundary } from "./components/error-boundary"
import { NotFound } from "./components/not-found"
import { ThemeProvider } from "./components/theme-provider"
import { Skeleton } from "./components/ui/skeleton"
import "./index.css"
Expand Down Expand Up @@ -41,6 +43,8 @@ const router = createRouter({
},
defaultPreload: "intent",
defaultPreloadStaleTime: 0,
defaultNotFoundComponent: NotFound,
defaultErrorComponent: ErrorBoundary,
})

declare module "@tanstack/react-router" {
Expand Down
4 changes: 0 additions & 4 deletions src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
useRouter,
} from "@tanstack/react-router"
import { Toaster } from "sonner"
import { RootErrorComponent } from "@/components/error-boundary"
import { NotFound } from "@/components/not-found"
import { useAnalytics } from "@/lib/analytics"

const TanStackRouterDevtools = import.meta.env.PROD

Check warning on line 11 in src/routes/__root.tsx

View workflow job for this annotation

GitHub Actions / lint-and-test

Fast refresh only works when a file only exports components. Move your component(s) to a separate file. If all exports are HOCs, add them to the `extraHOCs` option
? () => null
: lazy(() =>
import("@tanstack/react-router-devtools").then((mod) => ({
Expand All @@ -18,7 +16,7 @@
}))
)

const ReactQueryDevtools = import.meta.env.PROD

Check warning on line 19 in src/routes/__root.tsx

View workflow job for this annotation

GitHub Actions / lint-and-test

Fast refresh only works when a file only exports components. Move your component(s) to a separate file. If all exports are HOCs, add them to the `extraHOCs` option
? () => null
: lazy(() =>
import("@tanstack/react-query-devtools").then((mod) => ({
Expand All @@ -41,11 +39,9 @@

export const Route = createRootRouteWithContext<RouterContext>()({
component: RootComponent,
notFoundComponent: NotFound,
errorComponent: RootErrorComponent,
})

function RouteTracker() {

Check warning on line 44 in src/routes/__root.tsx

View workflow job for this annotation

GitHub Actions / lint-and-test

Fast refresh only works when a file only exports components. Move your component(s) to a separate file. If all exports are HOCs, add them to the `extraHOCs` option
const router = useRouter()
const analytics = useAnalytics()
useEffect(() => {
Expand All @@ -56,7 +52,7 @@
return null
}

function RootComponent() {

Check warning on line 55 in src/routes/__root.tsx

View workflow job for this annotation

GitHub Actions / lint-and-test

Fast refresh only works when a file only exports components. Move your component(s) to a separate file. If all exports are HOCs, add them to the `extraHOCs` option
return (
<>
<RouteTracker />
Expand Down
Loading