import React from "react"; interface ErrorBoundaryProps { children: React.ReactNode; } interface ErrorBoundaryState { error: Error | null; } /** * App-wide error boundary. The app previously had NONE - so any uncaught render error * (e.g. a component that throws on a resize-triggered re-render) would unmount the whole * React tree and leave a blank white screen until a hard refresh. This catches that, * shows a recoverable message + the error text (so the actual cause is visible instead of * a silent blank), and lets the user reload or dismiss. */ class ErrorBoundary extends React.Component { state: ErrorBoundaryState = { error: null }; static getDerivedStateFromError(error: Error): ErrorBoundaryState { return { error }; } componentDidCatch(error: Error, info: React.ErrorInfo) { // Keep the full detail in the console for diagnosis (component stack included). console.error("Uncaught error caught by ErrorBoundary:", error, info.componentStack); } private handleDismiss = () => this.setState({ error: null }); private handleReload = () => window.location.reload(); render() { const { error } = this.state; if (error) { return (

This screen could not be shown.

Reload the page, or dismiss this message to try again without ending your session.

              {error.message || String(error)}
            
); } return this.props.children; } } export default ErrorBoundary;