Skip to content

Fix collapse-all trigger causing newly mounted items to auto-collapse#111

Merged
everpcpc merged 1 commit intodatabendlabs:mainfrom
everpcpc:toronto-w3rz42d6
Feb 13, 2026
Merged

Fix collapse-all trigger causing newly mounted items to auto-collapse#111
everpcpc merged 1 commit intodatabendlabs:mainfrom
everpcpc:toronto-w3rz42d6

Conversation

@everpcpc
Copy link
Member

Summary

When clicking "Collapse Diff" or "Collapse All", the collapseAllTrigger counter increments. Components checked collapseAllTrigger > 0 in a useEffect to decide whether to collapse. However, when new items (diffs, tool calls, thinking blocks) mounted after the button was clicked, they saw the trigger was already > 0 and auto-collapsed on mount.

Fixed by capturing the trigger value at mount time via useRef and only reacting to values greater than the initial one. This makes collapse a one-time operation that only affects currently mounted items.

Files changed:

  • InlineDiffViewer.tsx — inline diffs in timeline
  • ToolCallMessage.tsx — tool call entries
  • ThinkingMessage.tsx — thinking blocks
  • TimelineView.tsxAgentResponse component

Tests

  • No Test - UI interaction bug, verified by code inspection

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

@everpcpc everpcpc marked this pull request as ready for review February 13, 2026 04:52
@everpcpc everpcpc merged commit c2e040e into databendlabs:main Feb 13, 2026
3 checks passed
@everpcpc everpcpc deleted the toronto-w3rz42d6 branch February 13, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments