Skip to content

Commit 78deb6c

Browse files
committed
docs(ai-chat): note the watchdog map scope and intentional chat keying
1 parent 55ec228 commit 78deb6c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

docs/ai-chat/frontend.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,8 @@ const transport = useTriggerChatTransport({
600600
A `message-sent` event means the message is durably written to the session's input stream (the stream the agent consumes from), so it's a true "sent successfully" signal. Because send and response events share the same callback, "sent but never answered" becomes a small client-side watchdog:
601601

602602
```ts
603+
// Module scope (or a ref) so re-renders don't recreate it. Keyed by chatId
604+
// on purpose: a new send on the same chat supersedes the in-flight turn.
603605
const pending = new Map<string, ReturnType<typeof setTimeout>>();
604606

605607
onEvent: (event) => {

0 commit comments

Comments
 (0)