033-setup-dashboard-store.md
1 --- 2 title: "MC-033: Setup Dashboard Store" 3 labels: ["chore", "state", "phase-0"] 4 assignee: null 5 --- 6 7 ## Tracer Bullet 8 9 ✅ Use `createStore` from @xstate/store and subscribe in React component 10 11 ## Context 12 13 Create the @xstate/store for application-level shared state (per ADR-001). 14 15 ## Acceptance Criteria 16 17 - [ ] `src/stores/dashboard.store.ts` created with createStore 18 - [ ] Store context includes: assets[], selectedAssetId, alerts[], uiPreferences 19 - [ ] React component uses useSelector to read store state 20 - [ ] Store transitions work with store.send() 21 22 ## Implementation Steps 23 24 1. Install @xstate/store dependency 25 2. Create dashboard.store.ts with createStore() 26 3. Define transitions for: asset.selected, aircraft.updated, mission.updated, transit.updated, alert.received 27 4. Subscribe in Map component with useSelector 28 5. Send store events from XState machines 29 30 ## Notes 31 32 - Store handles data coordination, not connection lifecycle 33 - Events from machines push data into store 34 - Store state drives all UI rendering