import { useLocation } from 'react-router-dom'; import { ErrorBoundary } from '@/components/ErrorBoundary'; /** * Per-route error boundary. * * The app has a single top-level ErrorBoundary (in main.tsx) as a last resort, * but on its own that means ANY component throwing blanks the ENTIRE app. This * wrapper adds a second, inner boundary around the routed page content so a * crash in one page shows a recoverable message while the app keeps running. * * It is keyed by the current pathname: navigating to a different route remounts * the boundary and clears the error automatically, so a broken page never * "sticks" once the user moves away. */ export function RouteErrorBoundary({ children }: { children: React.ReactNode }) { const location = useLocation(); return (
🛹

This page slammed

Something on this screen tripped up. Your account and data are safe. Head back and try again.

} > {children}
); } export default RouteErrorBoundary;