Uh oh!
There was an error while loading. Please reload this page.
docs(chat): document the fetcher chat transport for server functions - #681
Conversation
PR #512 added a first-class `fetcher` option to `useChat`/`ChatClient` for wiring a TanStack Start server function (that returns an SSE `Response`) into chat, but the connection-adapters page only covered the `stream()` path. Add a "Server Functions via `fetcher`" section, a "Pick a Transport" row, and a keyword so the new capability is discoverable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR updates the connection-adapters guide to add ChangesServer Functions via fetcher Transport
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
View your CI Pipeline Execution ↗ for commit 5a82e91
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
@tanstack/ai@tanstack/ai-anthropic@tanstack/ai-client@tanstack/ai-code-mode@tanstack/ai-code-mode-skills@tanstack/ai-devtools-core@tanstack/ai-elevenlabs@tanstack/ai-event-client@tanstack/ai-fal@tanstack/ai-gemini@tanstack/ai-grok@tanstack/ai-groq@tanstack/ai-isolate-cloudflare@tanstack/ai-isolate-node@tanstack/ai-isolate-quickjs@tanstack/ai-ollama@tanstack/ai-openai@tanstack/ai-openrouter@tanstack/ai-preact@tanstack/ai-react@tanstack/ai-react-ui@tanstack/ai-solid@tanstack/ai-solid-ui@tanstack/ai-svelte@tanstack/ai-utils@tanstack/ai-vue@tanstack/ai-vue-ui@tanstack/openai-base@tanstack/preact-ai-devtools@tanstack/react-ai-devtools@tanstack/solid-ai-devtoolscommit: |
Drop the "retries" claim (no such feature — the only `retry` in the client is SSE `retry:` control-line parsing) and fix the `stream()` factory description (it returns an `AsyncIterable<StreamChunk>`; it isn't a zero-arg factory). State the verifiable structural fact instead: `fetcher` normalizes to the same request-scoped adapter as `stream()`. Verified the server snippet typechecks without an `as any` cast. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…vs-iterable A `fetcher` can also return an `AsyncIterable<StreamChunk>` (sync or `Promise`-wrapped), not just a `Response` — the previous tip implied a clean Response/iterable split. The real distinction is that `stream()`'s factory must return the iterable *synchronously*, so an async server-function call (always a `Promise`) needs `fetcher` regardless of what it resolves to. Also corrects the pre-existing `stream()` section, which listed "TanStack Start server functions" as a `stream()` use case — those are async and hit the #509 type error; redirect them to `fetcher` and reframe `stream()` as the synchronous in-process / RSC / test path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🎯 Changes
Documents the
fetcherchat transport added in #512. That PR gaveuseChat/ChatClienta first-classfetcheroption for wiring a TanStack Start server function (one that returns an SSEResponseviatoServerSentEventsResponse(...)) straight into chat — but it shipped with no docs. The connection-adapters page only covered thestream()connection adapter, which can't typecheck aPromise<Response>(the original gap from #509).This is a small, docs-only change to
docs/chat/connection-adapters.md:fetcher" section with a server + client snippet, modeled on the existingstream()section and the media generation-hookfetcherdocs.Response-returning server functions atfetcher.fetcherkeyword in the page frontmatter for discoverability.fetcher(returns aResponse) vsstream()(returns anAsyncIterable<StreamChunk>).Snippets are checked against the current source (
ChatFetcher/ChatFetcherInputinpackages/ai-client/src/types.ts) and theexamples/ts-react-chatserver-fn route.✅ Checklist
pnpm test:docs(link checker) passes — no broken links.🚀 Release Impact
🤖 Generated with Claude Code
Summary by CodeRabbit