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

- 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:
Refactoring Agent
2026-05-03 12:26:30 +02:00
parent ca07719456
commit fef57d7a55
4 changed files with 268 additions and 150 deletions
+38
View File
@@ -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;
}
}
+2 -2
View File
@@ -95,8 +95,8 @@ export function StatsTab() {
const effectiveRegen = (effectiveRegenWithSpecials + manaCascadeBonus + manaWaterfallBonus) * meditationMultiplier;
// Get study speed/cost multipliers
const studySpeedMult = getStudySpeedMultiplier(skills, skillUpgrades, skillTiers);
const studyCostMult = getStudyCostMultiplier(skills, skillUpgrades, skillTiers);
const studySpeedMult = getStudySpeedMultiplier(skills);
const studyCostMult = getStudyCostMultiplier(skills);
// Check special effects
const hasManaWaterfall = hasSpecial(upgradeEffects, SPECIAL_EFFECTS.MANA_WATERFALL);