fix: GameStateDebug "Fill Mana" loop can freeze UI with large mana values #46
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Major
File:
src/components/game/debug/GameStateDebug.tsx(lines 95-100)Problem: The "Fill Mana" button loops
Math.floor(max - current)times callinggatherMana(). Ifmax - currentis very large (e.g., 100,000+), this will freeze the UI thread for seconds or minutes.Impact: Potential UI freeze / unresponsive game when using the debug fill mana feature with large mana pools.
Fix: Use
setRawMana(max)directly instead of looping:[priority: 4] BROKEN FEATURE — GameStateDebug "Fill Mana" loop can freeze UI with large mana values.
Starting work on #46. Reading GameStateDebug.tsx to fix the Fill Mana loop freeze.
Fixed. Replaced the loop-based Fill Mana implementation (which called gatherMana() in a loop up to max-current times) with a direct
useManaStore.setState()call that sets rawMana to the computed max. This prevents UI freeze with large mana pools.