Skip to content

fix(create): AI chat sample threadId and drop empty pnpm key - #525

Open
jherr wants to merge 1 commit into
mainfrom
fix/ai-threadid-and-empty-pnpm-key
Open

jherr wants to merge 1 commit into
mainfrom
fix/ai-threadid-and-empty-pnpm-key

Conversation

@jherr

@jherr jherr commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Two small fixes to scaffolded projects.

AI add-on chat sample missing threadId

@tanstack/ai-react's useChat requires a threadId on every call — it's a required field on ChatClientOptions (the conversation id used for the wire, DevTools, and persistence). The generated sample called useChat(chatOptions) with no threadId, so the app wouldn't type-check / run until hand-fixed.

The chat hook now passes a stable threadId:

export const useGuitarRecommendationChat = () =>
  useChat({ ...chatOptions, threadId: 'guitar-recommendations' })

A stable id is correct here since the demo chat has no persistence. The other AI demos (TTS, transcription, image, structured) use plain fetch rather than the generation hooks, so they needed no change.

Empty pnpm key in base templates

Both base templates carried an empty "pnpm": {}. Because mergePackageJSON keys off packageJSON.pnpm being truthy, that empty object made every generated project emit a useless, invalid empty pnpm field — even when no add-on needed onlyBuiltDependencies.

Removed "pnpm": {} from the React and Solid base package.json files. Add-ons that contribute pnpm.onlyBuiltDependencies (cloudflare, netlify, prisma, sentry, drizzle) still merge correctly via the overlay path.

Testing

  • package-json, create-app, and conditional-packages suites pass
  • Full pre-commit build + unit (294 create / 128 cli) + e2e (7) suites pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • The AI guitar recommendation chat now retains a consistent conversation thread.
  • Chores

    • Removed empty package manager settings from the React and Solid base templates.

The AI add-on's chat hook called useChat without the required threadId,
so the generated sample needed manual fixing before it would run. Pass a
stable threadId to useChat.

Both base templates carried an empty "pnpm": {}, which made every
generated project emit a useless empty pnpm field (mergePackageJSON keys
off a truthy pnpm). Remove it from the React and Solid bases; add-ons
that contribute pnpm.onlyBuiltDependencies still merge correctly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 55f3894

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@tanstack/create Patch
create-start-app Patch
create-tanstack-app Patch
create-tanstack Patch
create-tsrouter-app Patch
@tanstack/create-start Patch
@tanstack/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Walkthrough

The AI chat sample now passes a fixed thread ID to useChat. React and Solid base package manifests no longer include an empty pnpm configuration.

Changes: Create templates

Layer / File(s) Summary
AI chat sample and release metadata
.changeset/ai-threadid-and-empty-pnpm-key.md, packages/create/src/frameworks/react/add-ons/ai/assets/src/lib/demo-ai-hook.ts
The AI chat hook passes the fixed thread ID guitar-recommendations to useChat. The changeset records the update and the base manifest changes.
Base manifest pnpm configuration
packages/create/src/frameworks/react/project/base/package.json, packages/create/src/frameworks/solid/project/base/package.json
The React and Solid base package manifests remove the empty pnpm configuration. Their devDependencies objects remain empty.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • TanStack/cli#505: Adds Rsbuild support and changes the React and Solid base manifests and bundler overlay data.
Merge Risk: Minimal · up to 55f38

No actionable merge-blocking risk was identified in the changed templates.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies both main changes: adding a stable AI chat threadId and removing the empty pnpm key.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (3 skipped: 3 unsupported.)

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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