fix: resolve runtime issues with game loop, tabs, and error handling
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m45s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m45s
- Fix game loop store mismatch (page.tsx was using old store, gameHooks using new store) - Fix StatsTab.tsx calling getStudySpeedMultiplier with wrong arguments - Add ErrorBoundary to page.tsx for better error handling - Fix import syntax issues in page.tsx - Ensure build succeeds with fixes
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
'use client';
|
||||
|
||||
import { Component, ReactNode } from 'react';
|
||||
|
||||
interface ErrorBoundaryProps {
|
||||
children: ReactNode;
|
||||
fallback?: ReactNode;
|
||||
}
|
||||
|
||||
interface ErrorBoundaryState {
|
||||
hasError: boolean;
|
||||
error?: Error;
|
||||
}
|
||||
|
||||
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
||||
constructor(props: ErrorBoundaryProps) {
|
||||
super(props);
|
||||
this.state = { hasError: false };
|
||||
}
|
||||
|
||||
static getDerivedStateFromError(error: Error): ErrorBoundaryState {
|
||||
return { hasError: true, error };
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) {
|
||||
return this.props.fallback || (
|
||||
<div className="p-4 bg-red-900/20 border border-red-600/50 rounded">
|
||||
<h3 className="text-red-400 font-bold mb-2">Something went wrong:</h3>
|
||||
<pre className="text-xs text-red-300">{this.state.error?.message}</pre>
|
||||
<pre className="text-xs text-gray-500 mt-2">{this.state.error?.stack}</pre>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user