BUG: Elemental discipline category crashes with TypeError (reading 'includes') #243

Closed
opened 2026-06-01 10:48:04 +02:00 by Anexim · 1 comment
Owner

Bug Description

Clicking the "Elemental" discipline category button in the Disciplines tab causes a JavaScript error: TypeError: Cannot read properties of undefined (reading 'includes'). The tab fails to load and shows "disciplines tab failed to load."

Steps to Reproduce

  1. Open the Disciplines tab
  2. Click the "Elemental" category button (next to "Base", "Enchanter", "Fabricator", "Invoker")
  3. Observe: tab content is replaced with "disciplines tab failed to load" error message
  4. Console shows: TypeError: Cannot read properties of undefined (reading 'includes')

Expected Behavior

The Elemental discipline category should show the 7 elemental disciplines (Fire, Water, Air, Earth, Light, Dark, Death mana capacity disciplines).

Impact

  • All elemental disciplines are inaccessible from the UI
  • Player cannot view or activate any elemental discipline
  • Same bug likely affects "Enchanter", "Fabricator", and "Invoker" categories (not yet confirmed)

Likely Root Cause

A discipline prerequisite check is calling .includes() on an undefined value — likely unlockedElements or attunements array is undefined when checking if the player meets the requirements to view the category.

Files Involved

  • src/components/game/tabs/DisciplinesTab.tsx or src/components/game/tabs/DisciplineCard.tsx
  • src/lib/game/data/disciplines/elemental.ts — discipline definitions
## Bug Description Clicking the "Elemental" discipline category button in the Disciplines tab causes a JavaScript error: `TypeError: Cannot read properties of undefined (reading 'includes')`. The tab fails to load and shows "disciplines tab failed to load." ## Steps to Reproduce 1. Open the Disciplines tab 2. Click the "Elemental" category button (next to "Base", "Enchanter", "Fabricator", "Invoker") 3. Observe: tab content is replaced with "disciplines tab failed to load" error message 4. Console shows: `TypeError: Cannot read properties of undefined (reading 'includes')` ## Expected Behavior The Elemental discipline category should show the 7 elemental disciplines (Fire, Water, Air, Earth, Light, Dark, Death mana capacity disciplines). ## Impact - All elemental disciplines are inaccessible from the UI - Player cannot view or activate any elemental discipline - Same bug likely affects "Enchanter", "Fabricator", and "Invoker" categories (not yet confirmed) ## Likely Root Cause A discipline prerequisite check is calling `.includes()` on an undefined value — likely `unlockedElements` or `attunements` array is undefined when checking if the player meets the requirements to view the category. ## Files Involved - `src/components/game/tabs/DisciplinesTab.tsx` or `src/components/game/tabs/DisciplineCard.tsx` - `src/lib/game/data/disciplines/elemental.ts` — discipline definitions
Anexim added the ai:todo label 2026-06-01 10:48:04 +02:00
n8n-gitea was assigned by Anexim 2026-06-01 10:48:04 +02:00
Anexim added this to the (deleted) project 2026-06-01 11:45:48 +02:00
Author
Owner

Fixed. Added null guards (?? []) for activeIds and processedPerks in discipline-slice.ts activate/deactivate/processTick methods. The persisted Zustand store could have undefined values from corrupted/incompatible localStorage, causing TypeError: Cannot read properties of undefined (reading 'includes') when rendering discipline cards or processing ticks.

Fixed. Added null guards (`?? []`) for `activeIds` and `processedPerks` in `discipline-slice.ts` activate/deactivate/processTick methods. The persisted Zustand store could have `undefined` values from corrupted/incompatible localStorage, causing `TypeError: Cannot read properties of undefined (reading 'includes')` when rendering discipline cards or processing ticks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#243