Skip to content

Commit 0ff0656

Browse files
debug: add error boundary and simple fallback to test basic rendering
1 parent 4ec7a76 commit 0ff0656

File tree

3 files changed

+68
-11
lines changed

3 files changed

+68
-11
lines changed

src/components/ErrorBoundary.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React from 'react';
2+
3+
interface ErrorBoundaryState {
4+
hasError: boolean;
5+
error?: Error;
6+
}
7+
8+
export class ErrorBoundary extends React.Component<
9+
React.PropsWithChildren<object>,
10+
ErrorBoundaryState
11+
> {
12+
constructor(props: React.PropsWithChildren<object>) {
13+
super(props);
14+
this.state = { hasError: false };
15+
}
16+
17+
static getDerivedStateFromError(error: Error): ErrorBoundaryState {
18+
console.error('ErrorBoundary: Caught error:', error);
19+
return { hasError: true, error };
20+
}
21+
22+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
23+
console.error('ErrorBoundary: Error details:', {
24+
error: error.message,
25+
stack: error.stack,
26+
componentStack: errorInfo.componentStack
27+
});
28+
}
29+
30+
render() {
31+
if (this.state.hasError) {
32+
return (
33+
<div style={{ padding: '20px', color: 'red' }}>
34+
<h1>Something went wrong.</h1>
35+
<pre>{this.state.error?.message}</pre>
36+
<pre>{this.state.error?.stack}</pre>
37+
</div>
38+
);
39+
}
40+
41+
return this.props.children;
42+
}
43+
}

src/components/SimpleFallback.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export function SimpleFallback() {
2+
console.log('SimpleFallback: Rendering fallback component');
3+
4+
return (
5+
<div style={{
6+
padding: '20px',
7+
backgroundColor: 'white',
8+
color: 'black',
9+
minHeight: '100vh',
10+
display: 'flex',
11+
flexDirection: 'column',
12+
alignItems: 'center',
13+
justifyContent: 'center'
14+
}}>
15+
<h1>Simple Fallback Component</h1>
16+
<p>This is a test component to see if basic rendering works.</p>
17+
<p>If you can see this, the app can render basic content.</p>
18+
</div>
19+
);
20+
}

src/main.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { Toaster } from './components/ui/toaster.tsx';
1313
import './index.css';
1414
import { router } from './router.tsx';
1515
import { wagmiAdapter } from './utils/wagmiConfig.ts';
16+
import { ErrorBoundary } from './components/ErrorBoundary.tsx';
17+
import { SimpleFallback } from './components/SimpleFallback.tsx';
1618

1719
console.log('Starting app initialization...');
1820

@@ -36,17 +38,9 @@ try {
3638

3739
ReactDOM.createRoot(rootElement).render(
3840
<React.StrictMode>
39-
<WagmiProvider config={wagmiAdapter.wagmiConfig}>
40-
<QueryClientProvider client={queryClient}>
41-
<ConditionalRollbarWrapper
42-
rollbar={rollbar}
43-
rollbarConfig={rollbarConfig}
44-
>
45-
<RouterProvider router={router} />
46-
</ConditionalRollbarWrapper>
47-
</QueryClientProvider>
48-
</WagmiProvider>
49-
<Toaster />
41+
<ErrorBoundary>
42+
<SimpleFallback />
43+
</ErrorBoundary>
5044
</React.StrictMode>
5145
);
5246
console.log('App rendered successfully');

0 commit comments

Comments
 (0)