import { Component, type ErrorInfo, type ReactNode } from "react"; import { captureBrowserException } from "@/lib/sentry"; type AppErrorBoundaryState = { error: Error | null; }; /** * Last-resort boundary above the router and every provider that renders app * chrome. `RouteErrorBoundary` only guards the routed ``; a crash in * the shell around it (sidebar, providers, layout hooks) has no boundary, so * React unmounts the entire root and the user is left staring at a blank * page with no way forward but knowing to hard-refresh. This boundary trades * that blank page for a reload prompt. * * Deliberately dependency-free: no router, no toast, no query client — the * crash being handled may have originated inside any of those providers. */ export class AppErrorBoundary extends Component<{ children: ReactNode }, AppErrorBoundaryState> { override state: AppErrorBoundaryState = { error: null }; static getDerivedStateFromError(error: unknown): AppErrorBoundaryState { return { error: error instanceof Error ? error : new Error(String(error)) }; } override componentDidCatch(error: unknown, info: ErrorInfo): void { console.error("App shell crashed", { error, componentStack: info.componentStack }); captureBrowserException(error); } override render() { const { error } = this.state; if (!error) return this.props.children; return (

Paperclip hit an error

Something went wrong while running the app. Reloading usually fixes this.

          {error.message}
        
); } }