From 78e01032aec0b7f870084d5408f958bbfec6576f Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Tue, 24 Jun 2025 19:08:36 +1000 Subject: [PATCH] fix: Remove delay for instant reasoning block collapse - Remove 500ms setTimeout delay when reasoning finishes - Reasoning block now collapses immediately when response starts - Creates smoother transition from thinking to response phase - Eliminates jarring delay between reasoning end and collapse The reasoning block now collapses instantly as soon as the model starts generating the actual response, providing better UX flow. --- examples/chat-ui/src/components/ReasoningBlock.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/chat-ui/src/components/ReasoningBlock.tsx b/examples/chat-ui/src/components/ReasoningBlock.tsx index c8b6d7f..7b21fa1 100644 --- a/examples/chat-ui/src/components/ReasoningBlock.tsx +++ b/examples/chat-ui/src/components/ReasoningBlock.tsx @@ -15,14 +15,10 @@ const ReasoningBlock: React.FC = ({ }) => { const [isExpanded, setIsExpanded] = useState(isStreaming); // Start expanded when streaming - // Auto-collapse when streaming finishes + // Auto-collapse instantly when streaming finishes useEffect(() => { if (!isStreaming && startTime && endTime) { - // Add a small delay before collapsing so user can see completion - const timer = setTimeout(() => { - setIsExpanded(false); - }, 500); - return () => clearTimeout(timer); + setIsExpanded(false); } }, [isStreaming, startTime, endTime]);