←
PPLX-99
Created: 2026-01-01
•
Updated: 2026-01-01
Relationships
Loading...
Attachments
Loading...
Comments (1)
agent
·
2026-01-01
## Fix Applied
### Problem 1: Cannot expand collapsed section after streaming completes
**Root Cause:** The auto-collapse `useEffect` at line 68-77 was triggering repeatedly. When user clicked to expand:
1. `setInternalExpanded(true)` was called
2. But since `!isStreaming && internalExpanded` was true, the effect ran again
3. This immediately collapsed the section again
**Fix (ThinkingSection.tsx):**
- Added `hasAutoCollapsed` ref to track if we've already auto-collapsed once
- Added `prevIsStreaming` ref to detect when streaming starts (to reset the flag)
- Auto-collapse now only happens once per streaming session
- Manual user expansion is preserved after auto-collapse
### Problem 2: Newlines stripped from thinking content
**Root Cause:** The `<div>` wrapping the thinking content used default `whiteSpace: 'normal'` CSS, which collapses consecutive whitespace and newlines.
**Fix (ThinkingSection.tsx:149):**
- Added `whiteSpace: 'pre-wrap'` to `contentStyle`
- Newlines in thinking content now display as visual line breaks
### Tests Added (ThinkingSection.test.tsx):
- `allows manual expansion after auto-collapse` - verifies user can expand after auto-collapse
- `resets auto-collapse tracking when streaming starts again` - verifies the flag resets for new streaming sessions
- `preserves newlines in content with pre-wrap styling` - verifies CSS styling
### Verification:
All 27 ThinkingSection tests pass. The `parseThinkingContent` tests also pass (28 tests) - this utility already correctly preserved newlines in thinking content; the issue was purely in CSS display.