BUG: Elemental discipline category crashes with TypeError (reading 'includes') #243
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?
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
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
Likely Root Cause
A discipline prerequisite check is calling
.includes()on an undefined value — likelyunlockedElementsorattunementsarray is undefined when checking if the player meets the requirements to view the category.Files Involved
src/components/game/tabs/DisciplinesTab.tsxorsrc/components/game/tabs/DisciplineCard.tsxsrc/lib/game/data/disciplines/elemental.ts— discipline definitionsFixed. Added null guards (
?? []) foractiveIdsandprocessedPerksindiscipline-slice.tsactivate/deactivate/processTick methods. The persisted Zustand store could haveundefinedvalues from corrupted/incompatible localStorage, causingTypeError: Cannot read properties of undefined (reading 'includes')when rendering discipline cards or processing ticks.