Streaming responses render incrementally in the UI
Why it matters
Configuring streaming at the API level but awaiting the full response on the frontend is a silent no-op: the server dutifully streams tokens into a reader that buffers them all before a single setState call, producing the exact frozen-UI experience that streaming was supposed to eliminate. This bug pattern is extremely common when developers half-migrate from non-streaming to streaming and forget to update the consuming hook or component state logic.
Severity rationale
High because the server cost of streaming is paid while delivering zero perceived-performance benefit to users.
Remediation
In your chat hook at src/hooks/useChat.ts, read the response body with getReader() and update message state on every decoded chunk inside the loop rather than after it completes. Strongly prefer the Vercel AI SDK's useChat, which handles incremental state correctly by default.
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
setMessage(prev => prev + decoder.decode(value));
}
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the AI Chat Visibility Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-chat-visibility·automated