Fix Bug 8: Replace direct setState calls with proper store actions in debug components
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m8s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m8s
- SkillDebug.tsx: Use useSkillStore.getState().incrementSkillLevel() and setSkillLevel() instead of direct setState - ElementDebug.tsx: Use getState() for consistency - AttunementDebug.tsx: When unlocking Enchanter, also unlock transference element - GameStateDebug.tsx: Use proper store actions (debugSetFloor, resetFloorHP, debugSetTime) and fix Switch component usage
This commit is contained in:
@@ -29,8 +29,9 @@ export function GameStateDebug() {
|
||||
|
||||
// Get actions from stores
|
||||
const resetGame = useGameStore((s) => s.resetGame);
|
||||
const setFloor = useCombatStore((s) => s.debugSetFloor);
|
||||
const resetHP = useCombatStore((s) => s.resetFloorHP);
|
||||
const debugSetFloor = useCombatStore((s) => s.debugSetFloor);
|
||||
const resetFloorHP = useCombatStore((s) => s.resetFloorHP);
|
||||
const debugSetTime = useCombatStore((s) => s.debugSetTime);
|
||||
|
||||
const handleReset = () => {
|
||||
if (confirmReset) {
|
||||
@@ -186,13 +187,13 @@ export function GameStateDebug() {
|
||||
<Button size="sm" variant="outline" onClick={() => useGameStore.setState({ day: 1, hour: 0 })}>
|
||||
Day 1
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={() => setTime?.(10, 0)}>
|
||||
<Button size="sm" variant="outline" onClick={() => debugSetTime?.(10, 0)}>
|
||||
Day 10
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={() => setTime?.(20, 0)}>
|
||||
<Button size="sm" variant="outline" onClick={() => debugSetTime?.(20, 0)}>
|
||||
Day 20
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={() => setTime?.(30, 0)}>
|
||||
<Button size="sm" variant="outline" onClick={() => debugSetTime?.(30, 0)}>
|
||||
Day 30
|
||||
</Button>
|
||||
</div>
|
||||
@@ -250,14 +251,14 @@ export function GameStateDebug() {
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => setFloor?.(100)}
|
||||
onClick={() => debugSetFloor?.(100)}
|
||||
>
|
||||
Skip to Floor 100
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => resetHP?.()}
|
||||
onClick={() => resetFloorHP?.()}
|
||||
>
|
||||
Reset Floor HP
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user