revert: Remove debugging infrastructure while keeping bug fixes
Removed: - ErrorBoundary component and all error boundary wrapping - Debug console.log statements from useReasoningTranslation - Debug useEffect in DashboardPage - Dev mode Dockerfile (Dockerfile.kubernetes.dev) - Dev mode Tilt configuration - Enhanced vite watcher config (depth, awaitWriteFinish, HMR overlay) Kept actual bug fixes: - String() coercion in translation functions - useMemo/useCallback for formatters - Null guards in components - Basic vite ignored patterns (node_modules, dist, .git) - Conditional rendering in DashboardPage
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
import React, { Component, ErrorInfo, ReactNode } from 'react';
|
||||
|
||||
interface Props {
|
||||
children: ReactNode;
|
||||
componentName?: string;
|
||||
}
|
||||
|
||||
interface State {
|
||||
hasError: boolean;
|
||||
error?: Error;
|
||||
errorInfo?: ErrorInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Error Boundary to catch React errors and show debug information
|
||||
*/
|
||||
export class ErrorBoundary extends Component<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = { hasError: false };
|
||||
}
|
||||
|
||||
static getDerivedStateFromError(error: Error): State {
|
||||
return { hasError: true, error };
|
||||
}
|
||||
|
||||
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
||||
console.error('🔴 ErrorBoundary caught error:', {
|
||||
component: this.props.componentName || 'Unknown',
|
||||
error: error.message,
|
||||
stack: error.stack,
|
||||
componentStack: errorInfo.componentStack,
|
||||
});
|
||||
|
||||
this.setState({ error, errorInfo });
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) {
|
||||
return (
|
||||
<div className="bg-red-50 border-2 border-red-300 rounded-xl p-6 m-4">
|
||||
<h2 className="text-xl font-bold text-red-900 mb-2">
|
||||
🔴 Error in {this.props.componentName || 'Component'}
|
||||
</h2>
|
||||
<div className="bg-white rounded p-4 mb-4">
|
||||
<p className="text-sm font-mono text-red-800 mb-2">
|
||||
<strong>Error:</strong> {this.state.error?.message}
|
||||
</p>
|
||||
{this.state.error?.stack && (
|
||||
<details className="text-xs text-gray-700">
|
||||
<summary className="cursor-pointer font-semibold">Stack Trace</summary>
|
||||
<pre className="mt-2 overflow-auto">{this.state.error.stack}</pre>
|
||||
</details>
|
||||
)}
|
||||
</div>
|
||||
<button
|
||||
onClick={() => this.setState({ hasError: false, error: undefined, errorInfo: undefined })}
|
||||
className="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg"
|
||||
>
|
||||
Try Again
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user