From 35aad9b1693786aad5f2ae1aa6843deb82471c38 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Fri, 6 Mar 2026 09:28:12 +0100 Subject: [PATCH] fix(pitch-deck): Stale-Closure-Bug im Waiting-Indicator behoben MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit isWaiting im async Closure war immer true — lokale Variable firstChunk ersetzt den State-Check zuverlaessig. Co-Authored-By: Claude Sonnet 4.6 --- pitch-deck/components/ui/ChatInterface.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pitch-deck/components/ui/ChatInterface.tsx b/pitch-deck/components/ui/ChatInterface.tsx index fe29cd8..93a4eb9 100644 --- a/pitch-deck/components/ui/ChatInterface.tsx +++ b/pitch-deck/components/ui/ChatInterface.tsx @@ -48,16 +48,16 @@ export default function ChatInterface({ lang }: ChatInterfaceProps) { const reader = res.body!.getReader() const decoder = new TextDecoder() let content = '' + let firstChunk = true while (true) { const { done, value } = await reader.read() if (done) break - const chunk = decoder.decode(value, { stream: true }) - content += chunk + content += decoder.decode(value, { stream: true }) - if (isWaiting || content.length === chunk.length) { - // First chunk arrived — replace waiting indicator with real content + if (firstChunk) { + firstChunk = false setIsWaiting(false) setMessages(prev => [...prev, { role: 'assistant', content }]) } else {