import React from 'react'; interface ErrorBoundaryProps { children: React.ReactNode; } interface ErrorBoundaryState { error: Error | null; } /** * Catches render-time errors anywhere in the routed page tree so a single * failing page shows a readable message instead of blanking the whole admin * screen. The error is also logged to the console for debugging. */ class ErrorBoundary extends React.Component< ErrorBoundaryProps, ErrorBoundaryState > { constructor(props: ErrorBoundaryProps) { super(props); this.state = { error: null }; } static getDerivedStateFromError(error: Error): ErrorBoundaryState { return { error }; } componentDidCatch(error: Error, info: React.ErrorInfo): void { // eslint-disable-next-line no-console console.error('Recomaze render error:', error, info.componentStack); } render(): React.ReactNode { const { error } = this.state; const { children } = this.props; if (error) { return (

Something went wrong loading this page

{error.message || 'An unexpected error occurred.'}

); } return children; } } export default ErrorBoundary;