Skip to content

Right sidebar tab splits: layout and positioning foundation - #1601

Merged
brsbl merged 2 commits into
mainfrom
bb/sidebar-split-panes-thr_4rr623umv4
Aug 20, 2026
Merged

brsbl merged 2 commits into
mainfrom
bb/sidebar-split-panes-thr_4rr623umv4

Conversation

@brsbl

@brsbl brsbl commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • Added a persisted right-panel split layout that targets the active tab and reuses the existing pane arrangement model and controls.
  • Kept the existing right-panel header, tab behaviors, outer width resizer, collapse control, and full-screen behavior.
  • Added pane-local content and browser focus/lifecycle handling so visible split tabs retain the same panel semantics as the unsplit view.
  • Added focused coverage for split creation, positioning, resizing, tab movement, persistence, browser focus, and panel lifecycle.

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.
  • Exact-head visual QA used the same deterministic Sidebar Split QA fixture 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/main 5f4f3dec733612fcf23defd8ac17c22462715e9d

Viewport 1440 × 900 at DPR 2; image 2880 × 1800.

Before: unsplit right sidebar on origin main

After — foundation 3ad3d0f6c36b0b9b581360d0ca56d1c342b2b1a3

Viewport 1440 × 900 at DPR 2; image 2880 × 1800. Browser and Side chat occupy separate sidebar panes under the existing header.

After: Browser and Side chat split side by side

Exact-head screenshot matrix — 3ad3d0f6c36b0b9b581360d0ca56d1c342b2b1a3

All captures use the same Sidebar Split QA project and Primary split QA / Secondary split QA threads 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.

Page split with primary and secondary threads side by side

Medium — stacked thread pages

Viewport 1224 × 768 at DPR 2; image 2448 × 1536.

Page split with primary above secondary

Compact — stacked thread pages

Viewport 768 × 900 at DPR 2; image 1536 × 1800.

Compact page split with primary above secondary

Tab-split configurations

Wide — Browser and Side chat side by side

Viewport 1630 × 900 at DPR 2; image 3260 × 1800.

Wide right-sidebar tab split with Browser and Side chat

Medium — Browser and Side chat side by side

Viewport 1224 × 768 at DPR 2; image 2448 × 1536.

Medium right-sidebar tab split with Browser and Side chat

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.

Compact full-screen right panel with Browser and Side chat split panes

Ultra-wide — Browser and Side chat side by side

Viewport 3440 × 1440 at DPR 1; image 3440 × 1440.

Ultra-wide right-sidebar tab split

Fixes #1841

BB-Thread-ID: thr_4rr623umv4

AGENT GENERATED: by GPT-5

@bb-slop-cop

bb-slop-cop Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

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.

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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.

  1. The browser deck can unmount before it removes a closed native browser view. A hidden native view can also remain visible.
  2. A saved conversation full-screen state loses its only exit control after the sidebar splits.
  3. The compact drawer mounts all saved pane bodies, including terminal and browser views.
  4. Position-based React keys can move component state between panes.
  5. Pane focus calls a parent state update from a React state updater. I reproduced the React warning.
  6. A cancelled divider drag keeps changed DOM sizes but does not save them. I reproduced this size mismatch.
  7. 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/app type 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.

@brsbl
brsbl changed the base branch from bb/rename-queued-to-follow-ups-thr_4rr623umv4 to main August 15, 2026 02:30
@brsbl
brsbl requested review from ymichael August 17, 2026 19:39
@brsbl
brsbl force-pushed the bb/sidebar-split-panes-thr_4rr623umv4 branch 10 times, most recently from bf33f14 to 32e5041 Compare August 20, 2026 00:08
@brsbl
brsbl force-pushed the bb/sidebar-split-panes-thr_4rr623umv4 branch from 32e5041 to 3ad3d0f Compare August 20, 2026 00:35
@brsbl brsbl changed the title Add production right-sidebar split panes Add persistent, positionable tab splits to the right sidebar Aug 20, 2026
@brsbl brsbl changed the title Add persistent, positionable tab splits to the right sidebar Right sidebar tab splits: layout and positioning foundation Aug 20, 2026
@brsbl
brsbl merged commit 4e13e3f into main Aug 20, 2026
12 checks passed
@brsbl
brsbl deleted the bb/sidebar-split-panes-thr_4rr623umv4 branch August 20, 2026 02:09
ymichael added a commit that referenced this pull request Aug 20, 2026
## 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
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.

The thread right sidebar cannot split multiple panels

1 participant