import React, { Component, ReactNode } from 'react'; interface Props { children: ReactNode; fallback?: ReactNode; onError?: (error: Error, errorInfo: React.ErrorInfo) => void; showDetails?: boolean; } interface State { hasError: boolean; } class SourcesErrorBoundary extends Component { state = { hasError: false }; static getDerivedStateFromError() { return { hasError: true }; } componentDidCatch(error: Error, errorInfo: React.ErrorInfo) { console.error('Sources error:', error); this.props.onError?.(error, errorInfo); } render() { if (this.state.hasError) { // Use custom fallback if provided if (this.props.fallback) { return this.props.fallback; } // Default simple error UI (using localized strings from Sources.tsx fallback) /* eslint-disable i18next/no-literal-string */ return (
Sources temporarily unavailable
); /* eslint-enable i18next/no-literal-string */ } return this.props.children; } } export default SourcesErrorBoundary;