Skip to content

Commit fd653d6

Browse files
🤖 fix: prevent thinking block collapse on page load (#1011)
When navigating to a chat with existing thinking blocks, they would collapse immediately after the page loaded, causing a jarring layout shift. **Root cause:** The `ReasoningMessage` component initialized `isExpanded` to `true`, then a `useEffect` collapsed it when `isStreaming` was false. For historical messages (already `isStreaming: false`), this effect fired on mount—expanding then immediately collapsing. **Fix:** Initialize `isExpanded` to `message.isStreaming`. Historical messages start collapsed; actively streaming messages start expanded and collapse when streaming ends. --- _Generated with `mux`_
1 parent c80f3d3 commit fd653d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/browser/components/Messages/ReasoningMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ReasoningMessageProps {
1414
const REASONING_FONT_CLASSES = "font-primary text-[12px] leading-[18px]";
1515

1616
export const ReasoningMessage: React.FC<ReasoningMessageProps> = ({ message, className }) => {
17-
const [isExpanded, setIsExpanded] = useState(true);
17+
const [isExpanded, setIsExpanded] = useState(message.isStreaming);
1818
// Track the height when expanded to reserve space during collapse transitions
1919
const [expandedHeight, setExpandedHeight] = useState<number | null>(null);
2020
const contentRef = useRef<HTMLDivElement>(null);

0 commit comments

Comments
 (0)