Skip to content

Commit 0ecd6bd

Browse files
committed
fix(ui): restore full hydratedStreamingRef effect for reconnect path
1 parent c68263f commit 0ecd6bd

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,16 @@ export function ChatContent({
247247
smoothStreaming = true,
248248
}: ChatContentProps) {
249249
const hydratedStreamingRef = useRef(isStreaming && content.trim().length > 0)
250+
const previousIsStreamingRef = useRef(isStreaming)
251+
252+
useEffect(() => {
253+
if (!previousIsStreamingRef.current && isStreaming && content.trim().length > 0) {
254+
hydratedStreamingRef.current = true
255+
} else if (!isStreaming) {
256+
hydratedStreamingRef.current = false
257+
}
258+
previousIsStreamingRef.current = isStreaming
259+
}, [content, isStreaming])
250260

251261
const onWorkspaceResourceSelectRef = useRef(onWorkspaceResourceSelect)
252262
onWorkspaceResourceSelectRef.current = onWorkspaceResourceSelect

0 commit comments

Comments
 (0)