Skip to content

Commit 524d3c0

Browse files
Version Packages (#932)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 35edb27 commit 524d3c0

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

.changeset/fix-stale-agent-ref.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ai-chat/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @cloudflare/ai-chat
22

3+
## 0.1.2
4+
5+
### Patch Changes
6+
7+
- [#930](https://github.com/cloudflare/agents/pull/930) [`cd408fe`](https://github.com/cloudflare/agents/commit/cd408fe495176e67066ebbb3962c224ada702124) Thanks [@threepointone](https://github.com/threepointone)! - Fix stale agent reference in useAgentChat transport under React StrictMode
8+
9+
The `agentRef` was updated via `useEffect` (async, after render), but the `WebSocketChatTransport` is created in `useMemo` (sync, during render). When the agent reconnects or switches, `useMemo` would capture the old (closed) agent because the effect hadn't fired yet — causing `sendMessage` to send to a dead WebSocket. Fixed by updating `agentRef.current` synchronously during render, matching the pattern already used by other refs in the same hook.
10+
311
## 0.1.1
412

513
### Patch Changes

packages/ai-chat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudflare/ai-chat",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Cloudflare Agents (x) AI SDK Chat",
55
"keywords": [
66
"cloudflare",

0 commit comments

Comments
 (0)