Skip to content

Backport: [v6.0] fix(react): preserve chat when id is undefined#16830

Open
github-actions[bot] wants to merge 1 commit into
release-v5.0from
backport-pr-16797-to-release-v5.0
Open

Backport: [v6.0] fix(react): preserve chat when id is undefined#16830
github-actions[bot] wants to merge 1 commit into
release-v5.0from
backport-pr-16797-to-release-v5.0

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This is an automated backport of #16797 to the release-v5.0 branch. FYI @gr2m

Backport of #16484 to `release-v6.0`. Passing an explicitly-undefined
`id` to `useChat` recreated the internal `Chat` instance on every render
(because the `id` key exists in options while the generated chat ID
never equals `undefined`), wiping messages and stream state; the fix
changes the recreate guard to only apply when the provided `id` is
non-nullish. The `use-chat.ts` guard change and the changeset applied
cleanly; the regression test from the original commit conflicted only
because `main`'s test file wraps everything in an outer
`describe('use-chat')` block that does not exist on v6, so the new
`describe('undefined id')` block was re-indented to match v6's flat test
file structure with no semantic changes. Part of the v6.0 backport
tracking issue #16767.
@github-actions github-actions Bot enabled auto-merge (squash) July 6, 2026 20:07
@gr2m gr2m closed this Jul 7, 2026
auto-merge was automatically disabled July 7, 2026 23:43

Pull request was closed

@gr2m gr2m reopened this Jul 7, 2026
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