mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
f5c6bce54f6cdd1b2c163c27397a1ea9c217c8da
Problem: SessionContext used useSyncedSessionState which synced every state update from React useState to Zustand, creating double overhead and complexity. Solution: Complete migration to pure Zustand architecture: - session-store.ts is now the single source of truth - Moved ALL state directly into Zustand (no React useState) - Added per-session state: messages, agents, commands, permissions, etc. - Added Zustand actions for all state updates (setMessages, setAgents, etc.) - Exported all types (MessageEntry, Agent, Command, etc.) - session-context.tsx is now a pure WebSocket message handler - Removed useSyncedSessionState hook entirely - Removed all useState calls for session state - Removed sync machinery (syncSessionField, syncSessionPartial) - WebSocket handlers now call Zustand setters directly - Context only provides imperative APIs (ws, audioPlayer, actions) - No state values in context Architecture change: Before: WebSocket → React useState → sync → Zustand (double overhead) After: WebSocket → Zustand directly (single source of truth) Benefits: - Eliminated double overhead from React → Zustand syncing - Single state update per WebSocket message - Better re-render optimization via Zustand selectors - Cleaner separation: SessionProvider = message handler, SessionStore = state - Reduced complexity: removed 400+ lines of hybrid sync code Backward compatibility: - useDaemonSession() already reads from Zustand, no changes needed - Type exports re-exported from session-store for compatibility - Components work exactly the same 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Languages
TypeScript
98.1%
JavaScript
1.3%
Shell
0.1%
Swift
0.1%