import React, { ErrorInfo, ReactNode } from 'react'; interface ErrorBoundaryProps { children?: ReactNode; } interface ErrorBoundaryState { hasError: boolean; error: Error | null; } /** * Global Error Boundary to catch UI crashes and display a fallback screen. */ // Use React.Component explicitly to ensure proper inheritance and property access for props and state export default class ErrorBoundary extends React.Component { // Explicitly define properties for TypeScript to recognize them on the class instance public state: ErrorBoundaryState; public props: ErrorBoundaryProps; constructor(props: ErrorBoundaryProps) { super(props); // Initialize state in constructor to follow standard React patterns and avoid property conflicts this.state = { hasError: false, error: null }; this.props = props; } public static getDerivedStateFromError(error: Error): ErrorBoundaryState { return { hasError: true, error }; } public componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error("Uncaught license-tracker error:", error, errorInfo); } public render(): ReactNode { // Destructuring state and props from this. Inheritance from Component ensures they exist. // Explicit usage of this.state and this.props helps avoid shadowing or scoping issues. const { hasError, error } = this.state; const { children } = this.props; if (hasError) { return (

Application Failure

The interface encountered an unexpected error during rendering.

{error?.stack || error?.toString()}
); } return children || null; } }