feat(ui): drop the /ui createChatHook factory - #1269
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 31be36d
☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-byteplus
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-code-mode
@tanstack/ai-code-mode-snippets
@tanstack/ai-codex
@tanstack/ai-cohere
@tanstack/ai-compaction
@tanstack/ai-devtools-core
@tanstack/ai-durable-stream
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-grok-build
@tanstack/ai-groq
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-daytona
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-isolate-quickjs-bun
@tanstack/ai-llmgateway
@tanstack/ai-lovable
@tanstack/ai-mcp
@tanstack/ai-memory
@tanstack/ai-mistral
@tanstack/ai-octane
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-perplexity
@tanstack/ai-persistence
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-sandbox
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-upstash-box
@tanstack/ai-sandbox-vercel
@tanstack/ai-skills
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-utils
@tanstack/ai-vercel-gateway
@tanstack/ai-vertex
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
@tanstack/svelte-ai-devtools
commit: |
* feat(client): add createChatHook bound useChat factory
* feat(ui): align createChatUI with Form and Table factories
* feat(ui): move chat UI onto framework /ui subpaths
Fold the *-ui packages into @tanstack/ai-react/ui, @tanstack/ai-solid/ui, @tanstack/ai-vue/ui, and @tanstack/ai-svelte/ui.
createChatHook({ options, chatComponents }) returns useAppChat (Svelte: createAppChat). useAppChat mixes AppChat onto the instance so screens render <chat.AppChat />.
* ci: apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Restore @tanstack/ai-react-ui, ai-solid-ui, ai-vue-ui, and ai-svelte-ui as thin re-exports of the framework /ui subpath until 1.0.0. Document createChatHook, chat.AppChat, and the import path change.
That package never shipped on npm. Svelte chat UI lives on @tanstack/ai-svelte/ui. Keep deprecated shims only for the published react, solid, and vue UI packages.
0ed4bdd to
88e47e7
Compare
Render `<Chat chat={chat} components={components} />` with `useChat` /
`createChat` from the framework package. Keep options-only
`createChatHook` on the main package.
Keep ChatMessages, ChatInput, and the old Chat root as DeprecatedChat so the *-ui re-export shim still exposes those names. Drop unused shim devDependencies.
11244a8 to
31be36d
Compare
88e47e7 to
f71ed93
Compare
|
Heads up: #1252 was rewound to the pre-merge |
The
/uisubpath no longer owns the chat options. A screen callsuseChat(options)from the framework package, then passes that instance and a typedcomponentsmap to<Chat chat={chat} components={components} />.The factory
createChatHook({ options, chatComponents })and<chat.AppChat />are gone from/ui. Options-onlycreateChatHook(options)on the main package stays as it is.The question for you
The factory bound three things together: the chat options, the component catalog, and the React or Solid contexts. My argument is that the instance and the catalog are separate concerns, and that binding them costs more than it returns.
What this removes, per framework:
create-chat-hookin all four packages (React, Solid, Svelte, Vue).create-ui-contextsin React and Solid.chatContext,partContext, andinterruptContextobjects a user had to build and pass in. The chatbot example deleted its wholesrc/chat/ui-context.tsfor this.useChat.Net across the branch: 58 files, +1058 / -3741. Packages alone drop 1,940 lines.
Two things I want your read on:
useChatContext()from/uicovers what the three context objects did. Tell me if you had a case it does not cover.componentsis checked withsatisfies ChatUIComponents<typeof chatOptions>. Tool and interrupt names still infer. Tell me if you were protecting an inference case I broke.🎯 Changes
/uiexportsChatanduseChatContext. Screens calluseChatorcreateChatthemselves./uifactory that mixedAppChatonto the chat instance.ChatMessages/ChatInputon/ui. The old connection-based root isDeprecatedChat.<Chat chat={chat} components={components} />.create-chat-hookchangeset to match this API.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.docs/for this change, or this change is not user-facing.pnpm changeset), or this PR does not change a published package.🚀 Release Impact
Testing
Commands run
pnpm test:prpassed for all 86 projects after the rebase.pnpm install --frozen-lockfilepassed. The lockfile is consistent with the base branch.Manual test
pnpm --filter ts-react-ui-chatbot dev.examples/ts-solid-chat/solid-ui, the Vue UI inexamples/ts-vue-chat, andexamples/ts-svelte-chat/svelte-ui.How this PR makes testing easy
packages/ai-*/tests/chat-ui.testing/e2e/src/routes/headless-ui.tsxuse the publicChat+componentsAPI.Public API change
Before
After
createChatHook(options)on@tanstack/ai-reactstill returns a bounduseChat. It does not takechatComponents.Risk / rollback
This is a breaking change to the unreleased
/uifactory onfeat/typed-headless-chat-ui. Nothing published changes, because that branch has not shipped. A revert restorescreateChatHook({ options, chatComponents })and<chat.AppChat />. HeadlessuseChat(options)call sites do not change.Housekeeping
This branch carried nine commits that had already landed on
feat/typed-headless-chat-ui. That is why it read as 100 files and showed a conflict. I rebased onto the current base, so the diff is now the real 58 files and it merges clean. The content of the four commits did not change.