Skip to content

Client #52: Global error boundary and 404 page#82

Merged
raphael-frank merged 6 commits into
mainfrom
client/52-global-error-boundary-and-404
Jun 16, 2026
Merged

Client #52: Global error boundary and 404 page#82
raphael-frank merged 6 commits into
mainfrom
client/52-global-error-boundary-and-404

Conversation

@FadyGergesRezk

@FadyGergesRezk FadyGergesRezk commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Why

Implement error handling and 404 routing for the app. Users need a graceful fallback when the app crashes, and a clear 404 page when they hit non-existent routes.

What changed

  • ErrorBoundary.tsx (new) — React class component that catches unhandled rendering errors inside the authenticated app. Renders a centered ErrorCard with "Go home" and "Try again" (remounts via resetKey) actions.
  • NotFoundPage.tsx (new) — Functional component for the catch-all route. Renders a 404 heading with "Go back" and "Go home" buttons.
  • ErrorCard.tsx (new) — Shared full-page error UI used by both GlobalErrorBoundary and AuthenticatedApp, so there is one visual design for all error states.
  • main.tsxThemeProvider wraps everything so all error states (auth and runtime) are themed. AuthenticatedApp receives the QueryClient instance.
  • AuthenticatedApp.tsx — Auth errors render via ErrorCard directly. On success, mounts QueryClientProvider > GlobalErrorBoundary > App, so the boundary only covers the authenticated subtree and cannot intercept auth errors.
  • routes.tsx — Added catch-all route: { path: '*', element: <NotFoundPage /> } as the last child of the AppShell route.

Notes

GlobalErrorBoundary intentionally sits inside AuthenticatedApp (not outside it) because auth failures are async and cannot be caught by an error boundary — they must be handled with useState + try/catch. The boundary covers only runtime rendering errors after auth succeeds.

Testing

  • pnpm test — 30/30 passing
  • pnpm build — clean
  • pnpm typecheck — clean

Closes #52

@FadyGergesRezk FadyGergesRezk added client Issue regarding the client frontend enhancement New feature or request labels Jun 13, 2026
@raphael-frank

raphael-frank commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

lgtm! reasonable changes, merging.

@raphael-frank raphael-frank merged commit 5758e3d into main Jun 16, 2026
17 checks passed
@raphael-frank raphael-frank deleted the client/52-global-error-boundary-and-404 branch June 16, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Issue regarding the client frontend enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Global error boundary and 404 page

2 participants