🐛 Discipline pause button doesn't revert to "Activate" after pausing #120
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
When clicking the "Pause" button on an active discipline, the button text and state do not change back to "Activate". The discipline stops processing (is removed from
activeIds), but the UI still shows "Pause".Root Cause
In
src/lib/game/stores/discipline-slice.ts, thedeactivate()action only removes the discipline fromactiveIds:It does NOT set
disciplines[id].paused = true. So after deactivation:activeIds✓disciplines[id].pausedremainsfalse✗The
DisciplineCardcomponent readsdiscState.pausedfromdisciplines[disc.id]to determine button text (isPaused ? 'Activate' : 'Pause'). Sincepausedis stillfalse, the button keeps showing "Pause".Fix
Update
deactivate()to also setpaused: true:Files Involved
src/lib/game/stores/discipline-slice.ts(deactivate action)src/components/game/tabs/DisciplinesTab.tsx(DisciplineCard button rendering)Secondary Issue
The
activate()guardif (s.activeIds.includes(id)) return s;also prevents re-activating disciplines that were auto-paused byprocessTick(they remain inactiveIdswithpaused: true). This should be fixed to check!s.disciplines[id]?.pausedinstead.✅ Fixed. Changes made:
discipline-slice.ts —
deactivate()now setspaused: trueon the discipline state in addition to removing it fromactiveIds.Previously: Only removed the discipline from
activeIds, leavingdisciplines[id].pausedasfalse.Now: Also sets
disciplines[id].paused = true, so theDisciplineCardcomponent correctly shows "Activate" button text after deactivation.✅ Fixed discipline pause button - deactivate() now sets paused:true