Skip to content

Upgrade to Tambo AI React SDK v1#47

Open
michaelmagan wants to merge 1 commit intomainfrom
tambo-v1-migration
Open

Upgrade to Tambo AI React SDK v1#47
michaelmagan wants to merge 1 commit intomainfrom
tambo-v1-migration

Conversation

@michaelmagan
Copy link
Copy Markdown
Collaborator

Summary

  • Migrate from @tambo-ai/react@^0.65.3 to @tambo-ai/react@1.1.0
  • Replace deprecated hooks (useTamboThread, useTamboThreadInput) with v1 equivalents (useTambo, useTamboThreadList)
  • Remove useTamboStreamStatus from FontSettings and KeybindingsPicker to work around isPending bug with all-optional props
  • Add detailedSuggestion fallback in message-suggestions to prevent "Suggestion has no content" runtime error

Linear Issues

  • Resolves TAM-1290useTamboStreamStatus isPending never resolves when all props are optional
  • Resolves TAM-1291useTamboComponentState throws 409 during active streaming

Test plan

  • Verify app builds without errors (npm run build)
  • Verify chat thread creation and message sending works
  • Verify FontSettings component updates font and persists to localStorage
  • Verify KeybindingsPicker selects keybindings and applies after restart
  • Verify ThemePicker still works (unchanged)
  • Verify suggestion buttons work without "Suggestion has no content" error
  • Verify thread history loads and thread switching works

🤖 Generated with Claude Code

@charliecreates charliecreates Bot requested a review from CharlieHelps March 1, 2026 17:17
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tambo-strudel Ready Ready Preview, Comment Mar 25, 2026 9:42pm

Copy link
Copy Markdown
Contributor

@charliecreates charliecreates Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Thread list querying in ChatPage is now gated only by !useIsTamboTokenUpdating(), which may reintroduce the very early-401 behavior the previous contextKeyAndIdentityReady logic was preventing.
  • FontSettings and KeybindingsPicker removed 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 Message is 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 (old contextKey) and you reset threadInitialized when 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
    The ResourceCombobox key changed from resourceEntry.server.url to resourceEntry.server?.url. This avoids a crash when server is missing, but it also risks key collisions: multiple resources with server undefined will now share the same key prefix ("undefined-..."), and if resource.uri isn’t globally unique across those entries you’ll get unstable rendering.

  • Maintainability | src/components/tambo/font-settings.tsx:37-37
    The FontSettings component now removes all streaming-aware UI (disabled states, 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 as FontSettings: 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.submit changed to return { threadId }, but callers in this file treat it as Promise<void> (they await 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
    In ToolcallInfo, the associated tool result search now scans all messages and picks the first tool_result block matching toolUse.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 first tool_use block in the message. If an assistant message can contain multiple tool_use blocks (common in block-based formats), the UI will silently ignore all but the first, and the associatedToolResult scan 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/react from ^0.65.3^1.1.0 in package.json and updated package-lock.json accordingly.
  • 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:
    • useTamboThreaduseTambo
    • thread list shape itemsthreads
    • switched APIs: switchCurrentThreadswitchThread, cancelcancelRun
  • Introduced userKey scoping in provider (TamboProvider userKey={...}) and propagated userKey through thread history / full thread components.

UI/behavior adjustments

  • Removed useTamboStreamStatus usage from FontSettings and KeybindingsPicker (workaround for SDK bug TAM-1290).
  • Updated generation indicators and autoscroll logic to use streamingState.status (waiting/streaming) rather than generationStage.
  • Hardened suggestions by ensuring detailedSuggestion is always populated before calling accept().

Tool schema updates

  • Migrated tools (listSamples, validateAndUpdateRepl) to v1 defineTool() API and replaced toolSchema with inputSchema/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.

@charliecreates charliecreates Bot removed the request for review from CharlieHelps March 1, 2026 17:34
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant