Repository navigation
Restore compact sizing, search debounce, and label collapse in the plugin branch pickers - #4062
Merged
ymichael merged 4 commits intoSep 22, 2026
Conversation
…ugin branch pickers The worktree and project-checkout branch pickers left the shared BranchPicker when environment selection moved into plugins, and each lost behavior the shared component still implements. - Size the worktree option list to its content below md, so the compact drawer no longer renders a fixed 320px list for two rows. - Debounce the query usePluginBranches sends to the branches endpoint, so typing costs one host round trip instead of one per keystroke. - Split the worktree trigger label into prefix and value, marking the prefix compact-collapsible so a narrow promptbox shows the branch instead of "Branch from: ...". Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The 120ms search debounce lived in BranchPicker and, after the previous commit, in usePluginBranches. That is the shape that let the regression happen: the policy sat in a component, so callers that stopped rendering it silently started hitting the host on every keystroke. Move it to the two hooks that own the branch requests, useProjectSourceBranches and useEnvironmentMergeBaseBranches, through a shared useDebouncedBranchSearchQuery. BranchPicker now reports search queries to its consumers as they are typed, and no caller can forget the policy. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The hook now debounces before requesting branches, which decides whether a plugin should debounce its own search input. Record it on the SDK contract and in the experimental API audit entry. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The previous commit edited packages/plugin-sdk/src/app-contract.ts, which the version-lockstep check treats as a published surface change: bundled-types ship that comment, and the publish job never republishes an existing version. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
ymichael
force-pushed
the
bb/check-worktree-responsiveness-regression-thr_q4upmga6w5
branch
from
September 22, 2026 17:48
0dc28e2 to
93966c1
Compare
ymichael
deleted the
bb/check-worktree-responsiveness-regression-thr_q4upmga6w5
branch
September 22, 2026 18:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
When environment selection moved into plugins (#3227 for project checkout, #3932 for
worktrees), both branch pickers stopped rendering through
BranchPickerand silentlydropped behavior that component still implements. Three regressions followed, all
confirmed by driving the pickers in a dev app at 1440×900, 470×844 and 390×844:
plugins/environment-git-worktree/app.tsxpinned theoption list with an unconditional
h-80, so the compact drawer measured a flat390 × 399 in every state — 399 px of sheet for two rows. Every other branch picker
uses
min-h-0 max-h-[60vh] … md:max-h-80, which sizes to content belowmd.useDeferredValue(query)straight intoexperimental_useBranches, which is not a debounce. Typingfeatureissued 7GET /api/v1/projects/:id/branch-optionsrequests — 7 host round trips runninggit branch.BranchPickerdebounces the same query at 120 ms.Branch from: mainin one spaninstead of marking the prefix
data-promptbox-hide-compact. In a promptbox under30 rem the prefix is supposed to disappear; instead it consumed the chip, which read
Branch from: ...at 470 px andBranc...at 390 px, hiding the branch entirely.What changed
plugins/environment-git-worktree/app.tsx— option listh-80→md:h-80, so thecompact drawer sizes to content while the desktop popover keeps the stable 288 × 367
dimensions Support existing worktree selection and separate branch picker policy #3932 introduced. The trigger renders prefix and value as separate spans,
the prefix carrying
data-promptbox-hide-compactand the value the usual emphasis,matching the project-checkout chip.
apps/app/src/hooks/queries/branch-search-debounce.ts(new),project-queries.ts,environment-queries.ts— the debounce now lives in the twohooks that own branch requests,
useProjectSourceBranchesanduseEnvironmentMergeBaseBranches, behind a shareduseDebouncedBranchSearchQuery.A component holding this policy is what let the regression happen: callers that
stopped rendering
BranchPickersilently started hitting the host per keystroke.At the query boundary no caller can forget it, and the first render is still
immediate — only changes wait.
apps/app/src/components/pickers/BranchPicker.tsx— drops its own debounce andreports search queries to consumers as they are typed; both consumers feed them
back into the hooks above. Callers keep filtering cached results off the immediate
query, so lists still narrow on each keystroke.
packages/plugin-sdk/src/app-contract.ts,docs/api_to_audit.md— record thatexperimental_useBranchesdebouncesquery, since that decides whether a pluginshould debounce its own search input. No plugin source changed: the plugins never
held the debounce, they call
experimental_useBranchesand the implementation isapp-side, so nothing needs rebuilding against a new SDK.
No wire, CLI, or configuration changes, and no new public plugin API members.
How you verified
Measured in an isolated source dev app (fixture repo: 6 branches, 2 existing
worktrees), driven through headless Chromium:
branch-optionsrequests for 7 keystrokes, worktreebranch-optionsrequests for 6 keystrokes, project checkoutBranch from: ...mainThe after values match the project-checkout picker in the same states (266 px empty,
382 px listed), and the pre-#3932 worktree picker also issued 1 request for 7
keystrokes.
Tests:
usePluginBranchPickerState.test.tsxandenvironment-queries.test.tsx— newdebounce tests for both request paths; with the debounce removed they fail with 8
and 5 requests instead of 2.
plugins/environment-git-worktree/app.test.tsx— new compact-prefix test assertingthe prefix span carries
data-promptbox-hide-compactand the value does not; theexisting chip assertions move to the split-span text.
pnpm exec turbo run test typecheck --filter=bb-plugin-environment-git-worktree—96 tests, 5 files, typecheck clean.
pnpm exec turbo run test --filter=@bb/app -- src/components/plugin src/components/pickers src/components/secondary-panel/git-diff src/hooks/queries— 850 tests across the pickers, plugin bridge, git-diff panel, and query hooks.pnpm exec turbo run typecheck lint --filter=@bb/app— clean.Not covered: headless Chromium only, so the WebKit/iOS-Simulator drawer checks the UI
guidance asks for were not run, and the full repository suite was not run. The
merge-base picker's debounce is covered by the new
environment-queriestest ratherthan a live measurement. Unrelated
and untouched: branch-picker drawers have no bottom safe-area inset because
BRANCH_PICKER_CONTENT_CLASS_NAME'sp-0overrides the drawer padding, which has beentrue since #325 for all three pickers.