Repository navigation
Fix Activity thread options trigger ref loop - #7096
Conversation
📝 WalkthroughWalkthroughThis change extracts the inline "Thread list options" dropdown menu from ActivityPrototypePage.tsx into a new exported component, ActivityThreadOptionsMenu, which handles the overflow tooltip button, a compact-mode checkbox, and a mark-all-read action disabled when there are no unread threads. The main page render now uses this component, passing through compactMode, hasUnreadThreads, setCompactMode, and markAllThreadsRead. A new test file adds coverage for the extracted component's rendering and keyboard interaction. Changes
Sequence Diagram(s)sequenceDiagram
participant ActivityPrototypePage
participant ActivityThreadOptionsMenu
ActivityPrototypePage->>ActivityThreadOptionsMenu: pass compactMode, hasUnreadThreads
ActivityPrototypePage->>ActivityThreadOptionsMenu: pass setCompactMode, markAllThreadsRead
ActivityThreadOptionsMenu->>ActivityPrototypePage: onCompactModeChange callback
ActivityThreadOptionsMenu->>ActivityPrototypePage: onMarkAllThreadsRead callback
Estimated code review effort: 2 (Medium) Related issues: None found in the provided context. Related PRs: None found in the provided context. Suggested labels: frontend, tests, refactor Suggested reviewers: None specified. Poem: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 3b849b8a-e574-45df-a5ca-e81f2b50d343
📒 Files selected for processing (2)
src/renderer/src/components/activity/ActivityPrototypePage.tsxsrc/renderer/src/components/activity/ActivityThreadOptionsMenu.test.tsx
| return ( | ||
| <DropdownMenu> | ||
| <Tooltip> | ||
| <TooltipTrigger asChild> | ||
| {/* Why: keep Tooltip and Dropdown from composing refs onto the same | ||
| button; the crash report's stack loops through Radix setRef. */} | ||
| <span className="inline-flex shrink-0"> | ||
| <DropdownMenuTrigger asChild> | ||
| <Button | ||
| type="button" | ||
| variant="outline" | ||
| size="sm" | ||
| className="size-8 shrink-0 border-input bg-transparent p-0 text-muted-foreground shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-transparent dark:hover:bg-accent dark:hover:text-accent-foreground" | ||
| aria-label={translate( | ||
| 'auto.components.activity.ActivityPrototypePage.db8a1878b5', | ||
| 'Thread list options' | ||
| )} | ||
| > | ||
| <MoreVertical className="size-3.5" /> | ||
| </Button> | ||
| </DropdownMenuTrigger> | ||
| </span> | ||
| </TooltipTrigger> | ||
| <TooltipContent side="bottom"> | ||
| {translate('auto.components.activity.ActivityPrototypePage.a472a14700', 'More options')} | ||
| </TooltipContent> | ||
| </Tooltip> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the target component around the reported lines.
file="src/renderer/src/components/activity/ActivityPrototypePage.tsx"
wc -l "$file"
sed -n '860,930p' "$file"
# Map nearby structure to understand the trigger composition.
ast-grep outline "$file" --view expanded | sed -n '1,220p'
# Find similar composed trigger patterns in the renderer codebase.
rg -n "TooltipTrigger asChild|DropdownMenuTrigger asChild" src/renderer/src -g '*.{ts,tsx}' -A 6 -B 6
# Locate Radix tooltip/menu packages or docs references in repo metadata.
rg -n '"`@radix-ui/react-tooltip`"|"`@radix-ui/react-dropdown-menu`"|radix' package.json pnpm-lock.yaml yarn.lock package-lock.json -A 3 -B 3Repository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Read the exact target region with line numbers.
file="src/renderer/src/components/activity/ActivityPrototypePage.tsx"
sed -n '880,920p' "$file" | cat -n
# Search for local Radix tooltip implementation or docs references.
rg -n "aria-describedby|TooltipTrigger|asChild" . -g '*.{ts,tsx,js,jsx,md,mjs,cjs}' \
-g '!**/dist/**' -g '!**/build/**' -g '!**/node_modules/**' \
-A 3 -B 3 | sed -n '1,240p'
# If package metadata is present, identify the Radix version used.
rg -n '"`@radix-ui/react-tooltip`"|`@radix-ui/react-tooltip`' package.json pnpm-lock.yaml yarn.lock package-lock.json -A 4 -B 2Repository: stablyai/orca
Length of output: 22111
Keep TooltipTrigger on the focusable button
A plain <span> as the trigger moves aria-describedby off the button, so keyboard focus won’t pick up the tooltip text. Forward the tooltip props to the actual button instead of the wrapper.
Summary
Fixes crash report
fb583dd8-8c87-4cc7-9ea1-167b1d291f3dfrom Linux/WSL2 Activity view.The crash stack was React error #185 with
setRef -> Array.map -> setRefunderTooltipTrigger, which points at Radix composed refs recursively updating. The Activity thread-list overflow button hadTooltipTrigger asChildwrapped directly aroundDropdownMenuTrigger asChild, so both Radix triggers composed refs onto the same button.This PR extracts the thread options menu and inserts a real wrapper span as the tooltip target. The dropdown trigger still owns the button, but Tooltip no longer composes its ref onto the same DOM node.
Reproduction / Fix Evidence
fb583dd8-8c87-4cc7-9ea1-167b1d291f3d, boundaryapp.workspace-shell, active viewactivity, stack includessetRef,Array.map,TooltipTrigger.ActivityThreadOptionsMenutest failed because the button had no wrapper target, preserving the same same-node Radix ref composition from the report.pnpm vitest run --config config/vitest.config.ts src/renderer/src/components/activity/ActivityThreadOptionsMenu.test.tsx src/renderer/src/components/activity/ActivityPrototypePage.test.ts-> 2 files / 25 tests passed.pnpm exec oxlint src/renderer/src/components/activity/ActivityPrototypePage.tsx src/renderer/src/components/activity/ActivityThreadOptionsMenu.test.tsx-> passed.pnpm exec tsgo --noEmit -p config/tsconfig.tc.web.json-> passed.git diff --check-> passed.ELI5
The same button was wearing two different “I need to hold onto this element” hats. In some Activity sessions, those two hats could keep handing the button back and forth until React hit its safety limit and crashed the Activity page. Now the tooltip holds a tiny wrapper, and the menu holds the button, so they stop fighting over the same thing.
Trade-offs