You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(create): repair example assistant lifecycle - #446
Thanks for tracking down the navigation crash. This continues @killerfrienddk's fix, covers the same failure reported by @vilindh in #416, and repairs both Events and Resume examples with current dependencies.
AI review notes:
Both assistants now use React's external-store subscription API and return the store subscription's cleanup function. Header buttons use the current store updater API, and navigation no longer returns a subscription object as a React effect disposer.
Current TanStack AI requires thread IDs. Both examples provide them, reject missing IDs before calling a provider, forward IDs to chat, and infer message types from the actual hook. Generated content collection aliases and typed route parameters also make both examples compile with their current dependencies.
Validation: Agent-run Node 24 build and 471 unit tests pass. Both configured Chrome matrix cases pass: Events/npm and Resume/pnpm install, build, type-check, reject missing thread IDs with 400, stream a local mocked reply, and survive client navigation and remount. All eight existing blocking e2e tests pass. The normal commit hooks pass and reuse the matching Nx blocking-test result. Local Chrome teardown accounts for much of the 10.8/11.5 minute runner times. No live AI or deployment providers were called. The existing CLI lint errors in unchanged ui-prompts.ts lines 108 and 126 remain; lint is separate from the normal commit/CI gates.
The 13 affected source templates total 49,888 bytes before and 50,410 bytes after, an increase of 522 bytes. There are no dependency changes or changes to core CLI or generator logic. This is source byte accounting, not a startup or heap benchmark.
Summary by CodeRabbit
Bug Fixes
Improved assistant behavior in the Events and Resume examples: assistants stay in sync with their open or closed state and can be reopened after navigating between pages.
Chat requests without a valid thread ID now receive a clear error response instead of being processed.
Updated speaker and talk links to navigate to the correct detail pages.
Tests
Added end-to-end checks for assistant replies, theme display, navigation, and reopening in both examples.
The Events and Resume examples now use store-backed assistant visibility, explicit chat thread IDs, validated chat requests, and parameterized route links. The pull request also updates generated TypeScript configuration and adds end-to-end assistant lifecycle tests.
Both chat hooks set an explicit thread ID and derive message types from the hook return value. Both API routes reject missing or blank thread IDs and pass valid IDs to chat. The Events route also narrows the provider type.
Assistant store subscription and lifecycle packages/create/src/frameworks/react/examples/{events,resume}/assets/src/components/*Assistant*.tsx, packages/cli/tests-e2e/assistant-examples.spec.ts, .changeset/assistant-lifecycle.md
The assistant components derive visibility from their stores with useSyncExternalStore. The buttons use updater callbacks to open the assistants. End-to-end tests exercise both assistants, and the changeset records the package update.
Parameterized example links packages/create/src/frameworks/react/examples/events/assets/src/components/{SpeakerCard,TalkCard}.tsx, packages/create/src/frameworks/react/examples/events/assets/src/routes/{schedule.index.tsx,talks.$slug.tsx}
Speaker and talk links use parameterized routes and pass slugs through params.
TanStack/cli#525: Updates the AI scaffold with the same chat thread ID contract and message type inference approach.
Suggested reviewers:jherr
Merge Risk: Minimal · up to 1c73a
The assistant lifecycle and chat updates have no demonstrated merge-blocking issue.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely identifies the main change: repairing the example assistant lifecycle across the Events and Resume examples.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. 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 5 functions across 13 files. (2 skipped: 2 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
packages/cli/tests-e2e/assistant-examples.spec.ts
Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): packages/cli/tests-e2e/assistant-examples.spec.ts
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.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/create/src/frameworks/react/examples/events/assets/src/components/RemyAssistant.tsx`:
- Around line 91-94: The component currently calls
showRemyAssistant.subscribe(...) in the component body causing listener leaks
and render storms; move the subscription into a useEffect that runs on mount,
capture the returned Subscription and call subscription.unsubscribe() in the
effect cleanup, and keep setIsOpen inside the subscription callback;
alternatively (preferred) import and use the `@tanstack/react-store` useStore hook
to subscribe automatically and remove the duplicated local state and manual
subscribe/unsubscribe logic (references: showRemyAssistant, setIsOpen,
subscribe, unsubscribe, useEffect, useStore).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
Push a commit to this branch (recommended)
Create a new PR with the fixes
ℹ️ Review info⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: de3939c1-82ac-4a01-87fa-e785d35e0ced
📥 Commits
Reviewing files that changed from the base of the PR and between 5bbccb0 and 2bcae52.
tannerlinsley
changed the title
Fixed RemyAssistant.tsx - Where useeffect causes destroy is not a function error
fix(create): repair example assistant lifecycle
Nov 2, 2026
9-9: Minor · Data Integrity & Integration · Quick win
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Use a distinct ID for each conversation.
Every visitor and remount sends conference-assistant, even when its messages are independent. Consumers that group events by threadId cannot distinguish those conversations. Generate an ID that stays stable for the conversation. Apply the same fix to resume-ai-hook.ts Line 9. (github.com)
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 009c2746-68ca-455f-9e48-9541cdf36715
Commits
Reviewing files that changed from the base of the PR and between d819412 and 1c73aa1.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for tracking down the navigation crash. This continues @killerfrienddk's fix, covers the same failure reported by @vilindh in #416, and repairs both Events and Resume examples with current dependencies.
Summary by CodeRabbit