mirror of
https://github.com/jarrodwatts/claude-hud.git
synced 2026-05-21 07:22:44 +00:00
842 B
842 B
005 - HUD Store and Reducer Architecture
Status
Accepted
Context
The HUD app was previously managing IO and state derivation inside a React hook. That mixed FIFO reading, settings/config scanning, and UI state updates in one place, which made testing and reuse difficult.
Decision
Introduce a HudStore that owns IO and side effects, and a pure reducer for
state transitions.
tui/src/state/hud-store.tsmanages EventReader, trackers, and environment refresh intervals.tui/src/state/hud-reducer.tshandles event-driven state transitions.tui/src/state/hud-state.tsdefines public state and internal tracking.
Consequences
- UI code subscribes to a stable store and stays focused on rendering.
- Event handling is testable in isolation via reducer tests.
- Future renderers can reuse the store without React.