[priority: critical] Debug "Reset Game" does not reset discipline state #195
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?
CRITICAL BUG: Debug reset leaves discipline state stale in memory
Bug Summary
The Debug panel's "Reset Game" button clears localStorage but does NOT reset the in-memory discipline store state, causing disciplines to persist across resets without a page refresh.
Root Cause
src/lib/game/stores/gameActions.ts, lines 21-44 (createResetGame)reset()on UI, Prestige, Mana, and Combat stores, but NEVER callsuseDisciplineStore.getState().resetDisciplines()resetDisciplines()function exists atsrc/lib/game/stores/discipline-slice.tslines 158-165 but is never invoked by the reset logicWhat Happens
mana-loop-discipline-storekey is deleted from localStorage ✅Additional State at Risk
The reset should also verify these stores are properly cleared:
Steps to Reproduce
Fix Required
Add
useDisciplineStore.getState().resetDisciplines()tocreateResetGame()ingameActions.tsafter the otherreset*calls (around line 37). Also audit all other stores for similar missing reset calls.Priority
CRITICAL - Debug reset is broken; also affects any future soft-reset functionality
Starting investigation of debug reset not clearing discipline state.
Fixed: Added useDisciplineStore.getState().resetDisciplines(), useAttunementStore.getState().resetAttunements(), and useCraftingStore.getState().resetCrafting() to createResetGame() in gameActions.ts. Also added the resetCrafting() action to the crafting store (craftingStore.ts) and its type definition (craftingStore.types.ts), supported by a new createDefaultCraftingState() helper in crafting-initial-state.ts.