Upgrade to Tambo AI React SDK v1#47
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
- Thread list querying in
ChatPageis now gated only by!useIsTamboTokenUpdating(), which may reintroduce the very early-401 behavior the previouscontextKeyAndIdentityReadylogic was preventing. FontSettingsandKeybindingsPickerremoved streaming-aware UX entirely; even if done to work around TAM-1290, it’s a noticeable behavioral regression (interaction during active runs, no loading/error states).- MCP resource keys were made null-safe but potentially collision-prone (
server?.url), risking unstable list rendering. - Tool call result association in
Messageis now a global scan, which can mis-associate results in more complex threads/runs and has weak error detection.
Additional notes (7)
- Maintainability |
src/app/chat/page.tsx:228-228
useTamboThreadList()is now invoked with{}and only gated by!isTamboTokenUpdating. Previously you also waited for auth identity and a stable scoping key (oldcontextKey) and you resetthreadInitializedwhen the key changed.
With the new userKey model, thread history is scoped by userKey at the provider level, but this component no longer resets threadInitialized when the active userKey changes (login/logout). That can leave you stuck on a thread from the previous user scope (or skip re-initialization entirely) until a manual refresh.
This is a correctness issue that will show up on auth transitions.
-
Readability |
src/components/tambo/mcp-components.tsx:225-230
TheResourceComboboxkey changed fromresourceEntry.server.urltoresourceEntry.server?.url. This avoids a crash whenserveris missing, but it also risks key collisions: multiple resources withserverundefined will now share the samekeyprefix ("undefined-..."), and ifresource.uriisn’t globally unique across those entries you’ll get unstable rendering. -
Maintainability |
src/components/tambo/font-settings.tsx:37-37
TheFontSettingscomponent now removes all streaming-aware UI (disabledstates, loading skeleton, error rendering) and always allows interaction. That may be intended as a workaround for TAM-1290, but it’s a functional regression: during an active AI run, users can change font settings while the AI may also be trying to set them, and there is no visual indication of AI-driven updates.
Also, selectedFont now initializes to "monospace" rather than null, which can briefly mark "System" selected before localStorage is read (minor UI flicker).
- Maintainability |
src/components/tambo/keybindings-picker.tsx:49-49
Same regression pattern asFontSettings: removing streaming status handling means users can change keybindings while an AI run is ongoing, and there’s no longer an error surface if the SDK reports a stream-related problem. Given this triggers a runtime restart, allowing it during streaming is especially risky.
Additionally, the initialization effect depends on [keybindings] and reads localStorage on every prop change. That’s cheap, but it’s unnecessary work and can overwrite selectedKeybindings if keybindings changes later.
- Maintainability |
src/components/tambo/message-input.tsx:90-90
MessageInputContextValue.submitchanged to return{ threadId }, but callers in this file treat it asPromise<void>(theyawait submit()and ignore the result). That’s fine at runtime, but it creates an unnecessary contract change across your internal context API.
More importantly: removing contextKey from MessageInput means all message sending is now implicitly scoped to the current thread in useTamboThreadInput. If any caller still expects being able to target a different thread by passing contextKey, that capability is gone.
- Maintainability |
src/components/tambo/message.tsx:350-350
InToolcallInfo, the associated tool result search now scans all messages and picks the firsttool_resultblock matchingtoolUse.id. If there are multiple runs/tool uses with the same id across thread history (or if ids are only unique per-run), this could attach the wrong result. The previous logic scoped the tool response to messages after the tool call until the next tool call.
Also, hasToolError is inferred as toolUse.hasCompleted === false && !isLoading, which conflates “not completed” with “failed”. A completed tool use with an error payload would not be detected.
- Maintainability |
src/components/tambo/message.tsx:80-80
getToolUseBlock()returns the firsttool_useblock in the message. If an assistant message can contain multipletool_useblocks (common in block-based formats), the UI will silently ignore all but the first, and theassociatedToolResultscan will only match results for that first tool.
Even if Tambo currently emits only one, this is a brittle assumption and will cause confusing missing results if/when multi-tool messages appear.
Summary of changes
What changed
Dependency upgrade
- Upgraded
@tambo-ai/reactfrom^0.65.3→^1.1.0inpackage.jsonand updatedpackage-lock.jsonaccordingly. - Pulled in new transitive deps for v1 (e.g.
@ag-ui/core,rxjs,fast-json-patch,type-fest, updated@tanstack/react-query).
Tambo v1 API migration
- Replaced deprecated hooks:
useTamboThread→useTambo- thread list shape
items→threads - switched APIs:
switchCurrentThread→switchThread,cancel→cancelRun
- Introduced
userKeyscoping in provider (TamboProvider userKey={...}) and propagateduserKeythrough thread history / full thread components.
UI/behavior adjustments
- Removed
useTamboStreamStatususage fromFontSettingsandKeybindingsPicker(workaround for SDK bug TAM-1290). - Updated generation indicators and autoscroll logic to use
streamingState.status(waiting/streaming) rather thangenerationStage. - Hardened suggestions by ensuring
detailedSuggestionis always populated before callingaccept().
Tool schema updates
- Migrated tools (
listSamples,validateAndUpdateRepl) to v1defineTool()API and replacedtoolSchemawithinputSchema/outputSchema.
Message rendering internals
- Updated tool-call/component extraction to v1 content-block model (
tool_use,tool_result,component). - Updated cancelled detection to use
message.metadata?.cancelled.
Migrate from @tambo-ai/react@^0.65.3 to @tambo-ai/react@1.1.0. Key changes: - Replace deprecated hooks (useTamboThread, useTamboThreadInput, useTamboThreadList) with v1 equivalents (useTambo, useTamboThreadList) - Simplify message-input to use useTambo() directly - Update thread-history to use v1 thread list API - Remove useTamboStreamStatus from FontSettings and KeybindingsPicker to work around isPending bug with optional props (TAM-1290) - Add detailedSuggestion fallback in message-suggestions to prevent "Suggestion has no content" error from SDK accept() - Simplify tool schemas (listSamples, validateAndUpdateRepl) to v1 format - Update scrollable-message-container auto-scroll logic for v1 hooks Resolves: TAM-1290, TAM-1291 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
be6d1c5 to
b6df567
Compare
Summary
@tambo-ai/react@^0.65.3to@tambo-ai/react@1.1.0useTamboThread,useTamboThreadInput) with v1 equivalents (useTambo,useTamboThreadList)useTamboStreamStatusfrom FontSettings and KeybindingsPicker to work aroundisPendingbug with all-optional propsdetailedSuggestionfallback in message-suggestions to prevent "Suggestion has no content" runtime errorLinear Issues
useTamboStreamStatusisPending never resolves when all props are optionaluseTamboComponentStatethrows 409 during active streamingTest plan
npm run build)🤖 Generated with Claude Code