fix: combatStore.ts persist partialize saves wrong field for activeSpell #27

Closed
opened 2026-05-18 15:56:06 +02:00 by Anexim · 2 comments
Owner

Severity: Critical

File: src/lib/game/stores/combatStore.ts (line 273)

Problem: The partialize function includes activeSpell: state.activeAction — it saves currentAction (e.g., 'meditate', 'climb') into the activeSpell persisted key. On reload, activeSpell will be set to an action string like 'meditate' instead of a spell ID like 'manaBolt', which will break spell casting.

Impact: After page reload, the active spell will be corrupted to an action name. Spell casting will fail because SPELLS_DEF['meditate'] is undefined.

Fix: Change to activeSpell: state.activeSpell.

**Severity:** Critical **File:** `src/lib/game/stores/combatStore.ts` (line 273) **Problem:** The `partialize` function includes `activeSpell: state.activeAction` — it saves `currentAction` (e.g., `'meditate'`, `'climb'`) into the `activeSpell` persisted key. On reload, `activeSpell` will be set to an action string like `'meditate'` instead of a spell ID like `'manaBolt'`, which will break spell casting. **Impact:** After page reload, the active spell will be corrupted to an action name. Spell casting will fail because `SPELLS_DEF['meditate']` is undefined. **Fix:** Change to `activeSpell: state.activeSpell`.
Anexim added the ai:todo label 2026-05-18 15:56:06 +02:00
n8n-gitea was assigned by Anexim 2026-05-18 15:56:06 +02:00
Author
Owner

Starting work on combatStore.ts persist partialize saves wrong field for activeSpell

Starting work on combatStore.ts persist partialize saves wrong field for activeSpell
Author
Owner

Fixed: Changed activeSpell: state.activeAction to activeSpell: state.activeSpell in combatStore.ts partialize

Fixed: Changed `activeSpell: state.activeAction` to `activeSpell: state.activeSpell` in combatStore.ts partialize
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#27