Quick share of my current thoughts on the
@aisdk and
@tan_stack AI.
I've been using the ai-sdk for a while and I really like it overall.
That said, my biggest pain point is how useChat works.
Since all state lives inside a single hook, every component that uses useChat re-renders on every new streamed token.
The current workaround is putting useChat in a lightweight wrapper prop drilling component memoization to avoid re-renders. (not a great DX).
There are community solutions like ai-sdk-tools/store by
@pontusab, which syncs the context into a Zustand store so you can selectively subscribe. Which is cool, but it feels like something we shouldn't have to build ourselves.
When I heard about TanStack AI, I expected a TanStack Store style approach (similar to TanStack Form) with fine-grained subscriptions.
But from the docs, it looks like it uses the same useChat pattern.
Now I'm curious...
Am I missing something?
Is there a better way to use these libraries?
Or is this issue rare enough that it's not worth improving?