ta
TanStack
GitHub
ai
Workspace
GitHub
CI Pipeline Executions
Filtered
Runs
Demo
Insights
Compare tasks
Analytics
Sign in
Toggle sidebar
Overview
⌘K
ai
Loading workspace stats
Loading workspace insights...
Statistics interval
7 days
30 days
Latest CI Pipeline Executions
Status
Fix filter
Filter
Fuzzy
Filter range
Sort by
Sort by
Start time
Sort ascending
Sort descending
Succeeded
experiment/use-chat-tanstack-store
f958ed69 refactor(ai-client,ai-react): back ChatClient state with @tanstack/store Alternative to the hand-rolled subscribe/getSnapshot: hold ChatClient's reactive state in a @tanstack/store Store and consume it from React with @tanstack/react-store's useStore. ai-client: - Add @tanstack/store dependency. - Add ChatClientSnapshot (exported) and a `readonly store: Store<ChatClientSnapshot>` on ChatClient, seeded in the constructor. - Each setX mutator (loading/status/subscription/connection/session/error) and the messages handler calls syncStore(), which projects current state into the Store. The onXChange callbacks stay intact for existing consumers; the Store is additive. ai-react: - Add @tanstack/react-store dependency. - useChat reads client.store via useStore. A selector (useStore(client.store, s => s.messages)) could scope per-field re-renders; kept whole here to match the public API. vs the subscribe/getSnapshot branch: less hand-written plumbing and free selector support, at the cost of two new @tanstack/store deps. All 376 ai-client + 128 ai-react tests pass (typecheck requires ai-client to be built first, as ai-react resolves it via dist types). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
by Tom Beckenham
T
Succeeded
experiment/use-chat-tanstack-store
f958ed69 Merge 98838c4d97848a208c7a7a3e464a3df7780ea593 into 0fce6f1f8c68ef7effd1213bdf91da1239030a17
by Tom Beckenham
T
Previous
Next