From d84d8829c40968bf7fcb052a9823aeb3bcc59c33 Mon Sep 17 00:00:00 2001 From: Bert Verhelst Date: Mon, 16 Nov 2026 18:58:49 +0100 Subject: [PATCH] fix(vcs): branch pickers in the Git dialogs filter as you type (#3816) Merge, Rebase (upstream and --onto), Pull's remote branch and New Worktree's checkout used plain non-searchable Selects, so repositories with hundreds of branches could only be scrolled. They now share a BranchSelect that is always searchable, and a searchable Select opens its list with the typed key as the query when a key is pressed on the closed trigger. The agents' base-branch picker is searchable too. Closes #3788 Co-authored-by: bertyhell <1710840+bertyhell@users.noreply.github.com> --- src/features/agents/HomeEditor.tsx | 1 + .../vcs/__tests__/mergeDialogRepo.test.tsx | 31 +++++++++++++++- src/features/vcs/gitMenuDialogs.tsx | 22 ++++++++--- src/ui/Select.test.tsx | 33 +++++++++++++++++ src/ui/Select.tsx | 37 +++++++++++++++++-- 5 files changed, 114 insertions(+), 10 deletions(-) diff --git a/src/features/agents/HomeEditor.tsx b/src/features/agents/HomeEditor.tsx index f0bdc9021..5f286123c 100644 --- a/src/features/agents/HomeEditor.tsx +++ b/src/features/agents/HomeEditor.tsx @@ -280,6 +280,7 @@ export function HomeEditor({ docked = false, input }: { docked?: boolean; input? ; +} + /** Remote branches of `remote` without the remote prefix (`origin/main` → `main`). */ export function remoteBranchesOf(branches: readonly Branch[], remote: string): string[] { const prefix = `${remote}/`; @@ -255,7 +261,7 @@ function PullDialog({ initialRepo, onClose }: { initialRepo?: string | null; onC options={(remotes ?? []).map((r) => ({ value: r.name, label: r.name, detail: r.url }))} onChange={setRemote} /> - {useOnto ? tx`Rebase commits of ${head ?? "HEAD"} not on:` : `Rebase ${head ?? "HEAD"} onto:`} - + )} @@ -913,7 +925,7 @@ function NewWorktreeDialog({
Check out:
- , + ); + const trigger = screen.getByRole("button", { name: "Branch" }); + fireEvent.keyDown(trigger, { key: "d", ctrlKey: true }); + fireEvent.keyDown(trigger, { key: "Shift" }); + expect(screen.queryByRole("listbox")).toBeNull(); + fireEvent.keyDown(trigger, { key: "d" }); + const search = screen.getByRole("textbox"); + expect(search).toHaveValue("d"); + fireEvent.change(search, { target: { value: "dev" } }); + expect(labels()).toEqual(["develop", "feature/dev-tools"]); + key("Enter", search); + expect(onChange).toHaveBeenCalledExactlyOnceWith("develop"); + expect(screen.queryByRole("listbox")).toBeNull(); + }); + it("leaves typed keys to type-ahead when the list is not searchable", () => { + render(