Repository navigation
Right sidebar tab splits: layout and positioning foundation - #1601
Conversation
|
🚨 SLOP COP 🚨 · I am SlopCop, and I am reviewing this pull request now. This change adds split panes to the production right sidebar. It lets people open and resize several sidebar views at the same time. I will check security, code quality, architecture, performance, and the main user flow. I will post one final review after these checks finish. |
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
This PR lets people divide the right sidebar into several panes. It also saves each thread's pane layout.
I found seven issues. I would fix the first four before merge.
- The browser deck can unmount before it removes a closed native browser view. A hidden native view can also remain visible.
- A saved conversation full-screen state loses its only exit control after the sidebar splits.
- The compact drawer mounts all saved pane bodies, including terminal and browser views.
- Position-based React keys can move component state between panes.
- Pane focus calls a parent state update from a React state updater. I reproduced the React warning.
- A cancelled divider drag keeps changed DOM sizes but does not save them. I reproduced this size mismatch.
- No-op reconciliation causes repeat synchronous storage writes. Default layouts also create records without a retention limit.
The new code correctly uses the shared split-layout operations. However, it copies the existing split tree and divider renderer.
That copy already lost the existing divider's cancellation restore. A shared divider and stable pane-key helper would prevent this difference.
I found no injection, authorization, or command-execution defect. The native browser lifecycle issue can expose a hidden desktop view and keep private content active.
Validation passed:
- The
@bb/apptype check passed. - The 23 focused tests passed.
- The browser test covered split, resize, maximize, reload, and compact layouts.
- The browser test reproduced the pointer cancellation defect and the React warning.
- An independent GPT-5.6 review confirmed the seven findings.
I posted a line comment for each issue. This review uses the comment-only option.
bf33f14 to
32e5041
Compare
32e5041 to
3ad3d0f
Compare
## What was wrong [`SidebarSplitDivider`](https://github.com/get-bb/bb/blob/6be45053be92f964895038fc374a45e759087479/apps/app/src/components/secondary-panel/SidebarSplitContainer.tsx#L679-L757), introduced by [#1601](#1601), wrote both `cursor` and `user-select` to `document.body` at drag start and cleared them at drag finish. Both properties are inherited, so each write invalidated styles across the full app tree. That repeats the root cause measured in [#1992](#1992), where inherited body/root mutations cost hundreds of milliseconds per recalculation on a roughly 20k-element long-thread DOM. The divider also had no unmount cleanup for its native pointer listeners or temporary flex values. ## What changed - Keep the active split-divider cursor in local `SidebarSplitContainer` state instead of mutating `document.body` or the document root. - Mount the existing `IframeDragGuardOverlay` after the split content, with `col-resize` or `row-resize` for the active divider. This keeps the drag captured across iframe/browser-backed pane content without inserting a guard before a large sibling subtree. - Continue relying on the divider's existing pointer-down `preventDefault()` to prevent text selection, matching #1992. - Cancel the in-flight resize on divider unmount: remove native pointer listeners, release capture when held, clear drag chrome, and restore uncommitted flex values. - Remove the now-unused global body cursor helpers, while preserving the panel-library takeover used by main.tsx. This is an app-only change with no host-daemon protocol or other wire changes. It reuses the existing drag guard and straightforward component state; it does not introduce another split framework or alter the split layout model. ## How you verified The focused regression coverage failed before the production change and passed after it. Before the fix, the new assertions observed `cursor: col-resize; user-select: none` on `body` during pointer-down and a stuck `data-dragging="true"` state after unmount. - `pnpm exec turbo run test --filter=@bb/app --force -- src/components/secondary-panel/SidebarSplitContainer.test.tsx src/components/layout/AppLayout.sidebar-resize.test.tsx` — 2 files, 20 tests passed. - `pnpm exec turbo run build typecheck lint --filter=@bb/app` — build and typecheck passed; lint passed with 0 errors and 156 existing warnings. - `git diff --check` — passed. Coverage proves that split drag does not change body/document-root inline styles, pointer-down is default-prevented, the guard mounts after split content with both row and column cursors, pointer-up/cancel remove it, and unmount cancels the drag and removes its native listeners. ## Relationship to #1992 and #2059 This applies #1992's measured performance fix to the internal right-panel divider path that #1992 did not cover. Draft [#2059](#2059) fixes the separate mirrored split-tree correctness problem. Its current head (`4aca1e08`) still contains both body mutations, so it does not supersede this fix. The changes overlap only in `SidebarSplitContainer.tsx` and its test because #2059 rewrites that component; if #2059 lands first, the rebase should keep its single-tree rendering while retaining this PR's container-local cursor state, final drag guard, and divider cleanup. > AGENT GENERATED: by GPT-5.6-Sol
What was wrong
The thread right panel could show only one active tab at a time, so comparing or retaining multiple panel contexts required repeated tab switching. Its existing full-screen control had no way to position the active tab in a sidebar split. This is the foundation for #1841.
What changed
How you verified
pnpm exec vitest run apps/app/src/components/secondary-panel/BrowserTabDeck.browser-view-ordering.test.tsx apps/app/src/components/secondary-panel/ThreadSecondaryPanel.collapseControl.test.tsx apps/app/src/components/thread/terminal/useThreadTerminalController.test.ts apps/app/src/views/thread-detail/ThreadDetailSecondaryContent.test.tsx apps/app/src/views/thread-detail/SplitThreadArea.test.tsx— 66 tests passed.pnpm exec turbo run typecheck --filter=@bb/app— passed.git diff --check origin/main...HEAD— passed.Sidebar Split QAfixture in the launched bb desktop dev app. Captures are clipped to the rendered viewport so no off-viewport renderer content is included. Each caption records viewport and output dimensions.Before —
origin/main5f4f3dec733612fcf23defd8ac17c22462715e9dViewport 1440 × 900 at DPR 2; image 2880 × 1800.
After — foundation
3ad3d0f6c36b0b9b581360d0ca56d1c342b2b1a3Viewport 1440 × 900 at DPR 2; image 2880 × 1800. Browser and Side chat occupy separate sidebar panes under the existing header.
Exact-head screenshot matrix —
3ad3d0f6c36b0b9b581360d0ca56d1c342b2b1a3All captures use the same
Sidebar Split QAproject andPrimary split QA/Secondary split QAthreads in the exact-head desktop dev app.Page-split configurations
Wide — side-by-side thread pages
Viewport 1630 × 900 at DPR 2; image 3260 × 1800.
Medium — stacked thread pages
Viewport 1224 × 768 at DPR 2; image 2448 × 1536.
Compact — stacked thread pages
Viewport 768 × 900 at DPR 2; image 1536 × 1800.
Tab-split configurations
Wide — Browser and Side chat side by side
Viewport 1630 × 900 at DPR 2; image 3260 × 1800.
Medium — Browser and Side chat side by side
Viewport 1224 × 768 at DPR 2; image 2448 × 1536.
Compact — full-screen right panel
Viewport 1024 × 900 at DPR 2; image 2048 × 1800. Uses the existing Full Screen control so both split-tab labels and bodies remain legible under compact width pressure.
Ultra-wide — Browser and Side chat side by side
Viewport 3440 × 1440 at DPR 1; image 3440 × 1440.
Fixes #1841
BB-Thread-ID: thr_4rr623umv4