[Critical] [Bug] enterSpireMode crashes with ReferenceError: s is not defined #335

Closed
opened 2026-06-09 12:50:24 +02:00 by Anexim · 1 comment
Owner

Bug: enterSpireMode crashes with ReferenceError: s is not defined

Steps to reproduce

  1. Open the game
  2. Go to the Debug tab
  3. Click "Spire" in the debug panel
  4. Click "Enter Spire Mode"

Expected

Spire Mode activates, combat UI appears, currentFloor is shown.

Actual

Console error: ReferenceError: s is not defined at enterSpireMode. The button does nothing — Spire Mode stays OFF. The game also unexpectedly advances to Day 2.

Root cause

In src/lib/game/stores/combat-descent-actions.ts line ~275, the createEnterSpireMode function references s.golemancy but s is not defined in scope. The function receives get and set parameters but the state variable s is not declared.

golemancy: { activeGolems: [], lastSummonFloor: 0, golemDesigns: s.golemancy?.golemDesigns ?? {}, golemLoadout: [] },

Should use get().golemancy instead of s.golemancy.

Store

useCombatStorecombat-descent-actions.tscreateEnterSpireMode

## Bug: `enterSpireMode` crashes with `ReferenceError: s is not defined` ### Steps to reproduce 1. Open the game 2. Go to the Debug tab 3. Click "Spire" in the debug panel 4. Click "Enter Spire Mode" ### Expected Spire Mode activates, combat UI appears, currentFloor is shown. ### Actual Console error: `ReferenceError: s is not defined` at `enterSpireMode`. The button does nothing — Spire Mode stays OFF. The game also unexpectedly advances to Day 2. ### Root cause In `src/lib/game/stores/combat-descent-actions.ts` line ~275, the `createEnterSpireMode` function references `s.golemancy` but `s` is not defined in scope. The function receives `get` and `set` parameters but the state variable `s` is not declared. ```typescript golemancy: { activeGolems: [], lastSummonFloor: 0, golemDesigns: s.golemancy?.golemDesigns ?? {}, golemLoadout: [] }, ``` Should use `get().golemancy` instead of `s.golemancy`. ### Store `useCombatStore` → `combat-descent-actions.ts` → `createEnterSpireMode`
Anexim added the ai:todo label 2026-06-09 12:50:24 +02:00
n8n-gitea was assigned by Anexim 2026-06-09 12:50:24 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-09 14:47:11 +02:00
Author
Owner

Fix Applied

File: src/lib/game/stores/combat-descent-actions.ts

Change: On line 275, replaced s.golemancy?.golemDesigns with get().golemancy?.golemDesigns inside the set() call within createEnterSpireMode.

Root cause: The createEnterSpireMode function receives get and set parameters but never declares a local s variable (unlike other functions in the file that do const s = get()). The set() callback referenced s.golemancy which was undefined, causing a ReferenceError: s is not defined.

Verification:

  • All 1090 tests pass (59 test files)
  • Next.js production build succeeds
  • Pre-commit hooks pass (file size, tests, circular deps)
## Fix Applied **File:** `src/lib/game/stores/combat-descent-actions.ts` **Change:** On line 275, replaced `s.golemancy?.golemDesigns` with `get().golemancy?.golemDesigns` inside the `set()` call within `createEnterSpireMode`. **Root cause:** The `createEnterSpireMode` function receives `get` and `set` parameters but never declares a local `s` variable (unlike other functions in the file that do `const s = get()`). The `set()` callback referenced `s.golemancy` which was undefined, causing a `ReferenceError: s is not defined`. **Verification:** - ✅ All 1090 tests pass (59 test files) - ✅ Next.js production build succeeds - ✅ Pre-commit hooks pass (file size, tests, circular deps)
Anexim added ai:done and removed ai:in-progress labels 2026-06-09 14:49:31 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#335