Skip to content

fix(chat): clear streaming state when the stream finishes#707

Open
bdtsimon wants to merge 1 commit into
outsourc-e:mainfrom
bdtsimon:fix/stale-streaming-state
Open

fix(chat): clear streaming state when the stream finishes#707
bdtsimon wants to merge 1 commit into
outsourc-e:mainfrom
bdtsimon:fix/stale-streaming-state

Conversation

@bdtsimon

@bdtsimon bdtsimon commented Jul 8, 2026

Copy link
Copy Markdown

Problem

On stream finish the hook left streamingText set to the final text and kept streamingMessageId, so completed-stream state could leak into the next render — e.g. a first/new-chat reply briefly appearing as separate p + pong fragments, or stale streaming state lingering.

Fix

Clear streamingMessageId and streamingText when the stream ends; the finalized ChatMessage is appended separately (unchanged). One-line change in use-streaming-message.ts.

Found and fixed while running a self-hosted deployment; a new chat with reply exactly: pong now returns a clean pong.

Reviewed by bdtsimon

On finish the hook left streamingText set to the final text (and kept
streamingMessageId), so a completed stream could leak stale streaming state into
the next render — e.g. a first/new chat reply appearing as separate "p" + "pong"
fragments. Clear streamingMessageId and streamingText on finish; the finalized
message is appended separately.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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