fix: DisciplinesTab.tsx uses getState() during render — breaks React subscription #33
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?
Severity: Critical
File:
src/components/game/tabs/DisciplinesTab.tsx(lines 51, 62, 72, 82, 196, 212)Problem: The
DisciplineCardcomponent and the mainDisciplinesTabcomponent calluseDisciplineStore().getState()directly during render. This reads the current state outside of React's subscription mechanism, meaning:Impact: The Disciplines tab will show stale data and won't update when disciplines gain XP, get paused, or when the active attunement changes.
Fix: Use Zustand's selector pattern instead:
For the
DisciplineCardcomponent, pass needed values as props from the parent which subscribes to the store properly.Fixed: Refactored DisciplinesTab.tsx to pass discipline state and toggle handler as props to DisciplineCard, eliminating getState() calls during render. The parent component now subscribes to the store via selectors and passes data down.