Repository navigation
Add a one-click Archive button to hovered sidebar thread rows - #1965
Conversation
| unarchiveThread(thread); | ||
| return; | ||
| } | ||
| archiveThreadAndChildren(thread); |
There was a problem hiding this comment.
🚨 slopcop/review — Rapid archives can lose the first result callbacks.
All rows call one shared TanStack mutation. A second call removes the observer from the first call. The first request continues, but its per-call success or error callbacks do not run. The user can lose the first Undo toast, pane closure, navigation update, or error message. This button removes the row immediately, so the next archive button moves under the cursor and makes rapid calls likely. Move the result effects into mutation-level callbacks, or serialize archive actions.
| SIDEBAR_MORE_ACTION_TRIGGER_CLASS, | ||
| // Tighter than two full margins: a half step between the | ||
| // two glyphs reads as one control group. | ||
| "-mr-0.5", |
There was a problem hiding this comment.
🚨 slopcop/review — The two expanded click targets overlap.
Each action has a 28-pixel pseudo-element target. This negative margin puts the target centers 22 pixels apart. The targets overlap by 6 pixels. The later menu target can receive a click aimed at the Archive button. Remove the negative margin, or clip each pseudo-element at the midpoint. Add a browser pointer test for this geometry.
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
This pull request adds an Archive icon beside the thread menu on hover. It uses the existing archive action and reserves title space.
I found two issues that need fixes:
- Rapid clicks can start two archives through one shared TanStack mutation. The first request can lose its Undo and completion effects.
- The Archive and menu click targets overlap by 6 pixels. The menu can receive a click intended for Archive.
I left inline comments with causes and suggested fixes.
The security, code quality, architecture, and performance reviews found no other actionable defect. The architecture scan found no useful larger refactor.
All GitHub checks passed. I also ran 82 focused tests from the exact pull request head, and all tests passed.
The browser worker started the pull request app and loaded it in Chromium. It did not complete the hover and click flow.
|
Addressed both SlopCop findings in 569c22f:
|
Hovering a thread row now reveals an Archive button left of the "..." menu trigger. It reuses the ThreadActionsProvider archive/unarchive lifecycle, so the child cascade, navigation, and undo behave like the menu entry. The hover overlay is anchored to the row's right edge so it can hold two actions, and a new bb-sidebar-hover-actions-inset class reserves one action width on the title while the row is hovered, focused, or has an open menu, so long titles truncate instead of running under the button. The overlay stays hidden on coarse phones, where no room is reserved. Fixes #1958 Co-Authored-By: Claude <[email protected]>
Archive now uses mutateAsync so each call keeps its own Undo toast, pane closure, and error report; per-call mutate callbacks only fire for the latest call on the shared observer, which rapid one-click archives make likely. The archive and menu buttons' 28px pseudo-targets overlapped, so the later menu could take a click aimed at Archive. New paired-target classes stop each target at the midpoint of the 2px gap. Co-Authored-By: Claude <[email protected]>
569c22f to
c04de55
Compare
What was wrong
Archiving a thread from the sidebar took two or three actions: open the
…menu or the right-click menu, then pick Archive. Users who clean up many threads a day asked for a one-click hover button like Cursor has (#1958, which supersedes #1159; the keyboard shortcut from #1172 is opt-in and not discoverable from the list).What changed
apps/app/src/components/thread/ThreadActionsMenu.tsx: newThreadArchiveQuickAction, an icon button with a tooltip that calls the samearchiveThreadAndChildren/unarchiveThreadactions as the menu entry. It uses the existingArchive/ArchiveRestoreicons and stops propagation so the row link does not navigate.apps/app/src/components/sidebar/ThreadRow.tsx: the hover overlay is anchoredinset-y-0 right-0so it can hold two actions; the archive button sits left of theMoreHorizontaltrigger with a 2px gap.apps/app/src/components/ui/theme.css+sidebar-hover-actions.ts: newbb-sidebar-hover-actions-insetclass reserves one action width on the title under the same row states that reveal the overlay (hover, focus-visible, open menu), so long titles truncate instead of running under the button. Reset to 0 on coarse phones where the overlay is hidden. Not applied when the row shows a shortcut pill instead of hover actions.No wire, CLI, or doc changes; no new icon registered.
How you verified
ThreadArchiveQuickAction.test.tsx: one click archives without bubbling to the row; an archived thread unarchives instead.ThreadRow.test.tsxmock and wrappedProjectRow.interactions.test.tsxrenders inTooltipProvider.pnpm exec turbo run typecheck lint test --filter=@bb/app: 404 files, 3100 tests pass.…, click removed the row and setarchived_atin the dev DB; long title truncates before the button.Fixes #1958