Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Inline branch picker filtering and drop PR-only shortcut

Julius Marmingeac3f22c274e5
diff --git a/apps/web/src/components/BranchToolbar.logic.test.ts b/apps/web/src/components/BranchToolbar.logic.test.ts
index e940fe2c3..b61e11c73 100644
--- a/apps/web/src/components/BranchToolbar.logic.test.ts
+++ b/apps/web/src/components/BranchToolbar.logic.test.ts
@@ -1,7 +1,6 @@
import type { GitBranch } from "@t3tools/contracts";
import { describe, expect, it } from "vitest";
import {
- filterBranchPickerItems,
dedupeRemoteBranchesWithLocalMatches,
deriveLocalBranchNameFromRemoteRef,
resolveBranchSelectionTarget,
@@ -197,34 +196,6 @@ describe("dedupeRemoteBranchesWithLocalMatches", () => {
});
});
-describe("filterBranchPickerItems", () => {
- it("shows only the pull request action when the query is a PR reference", () => {
- expect(
- filterBranchPickerItems({
- itemValues: [
- "__checkout_pull_request__:488",
- "codething/76f09488",
- "origin/cursor/rollback-error",
- ],
- normalizedQuery: "488",
- createBranchItemValue: null,
- checkoutPullRequestItemValue: "__checkout_pull_request__:488",
- }),
- ).toEqual(["__checkout_pull_request__:488"]);
- });
-
- it("filters branch items normally when the query is not a PR reference", () => {
- expect(
- filterBranchPickerItems({
- itemValues: ["feature/488", "main", "__create_new_branch__:48"],
- normalizedQuery: "48",
- createBranchItemValue: "__create_new_branch__:48",
- checkoutPullRequestItemValue: null,
- }),
- ).toEqual(["feature/488", "__create_new_branch__:48"]);
- });
-});
-
describe("resolveBranchSelectionTarget", () => {
it("reuses an existing secondary worktree for the selected branch", () => {
expect(
diff --git a/apps/web/src/components/BranchToolbar.logic.ts b/apps/web/src/components/BranchToolbar.logic.ts
index 79acb487c..64ec2956c 100644
--- a/apps/web/src/components/BranchToolbar.logic.ts
+++ b/apps/web/src/components/BranchToolbar.logic.ts
@@ -89,30 +89,6 @@ export function dedupeRemoteBranchesWithLocalMatches(
});
}
-export function filterBranchPickerItems(input: {
- itemValues: ReadonlyArray<string>;
- normalizedQuery: string;
- createBranchItemValue: string | null;
- checkoutPullRequestItemValue: string | null;
-}): ReadonlyArray<string> {
- const { itemValues, normalizedQuery, createBranchItemValue, checkoutPullRequestItemValue } = input;
-
- if (checkoutPullRequestItemValue) {
- return [checkoutPullRequestItemValue];
- }
-
- if (normalizedQuery.length === 0) {
- return itemValues;
- }
-
- return itemValues.filter((itemValue) => {
- if (createBranchItemValue && itemValue === createBranchItemValue) {
- return true;
- }
- return itemValue.toLowerCase().includes(normalizedQuery);
- });
-}
-
export function resolveBranchSelectionTarget(input: {
activeProjectCwd: string;
activeWorktreePath: string | null;
diff --git a/apps/web/src/components/BranchToolbarBranchSelector.tsx b/apps/web/src/components/BranchToolbarBranchSelector.tsx
index 766b28481..1817e2907 100644
--- a/apps/web/src/components/BranchToolbarBranchSelector.tsx
+++ b/apps/web/src/components/BranchToolbarBranchSelector.tsx
@@ -26,7 +26,6 @@ import {
dedupeRemoteBranchesWithLocalMatches,
deriveLocalBranchNameFromRemoteRef,
EnvMode,
- filterBranchPickerItems,
resolveBranchSelectionTarget,
resolveBranchToolbarValue,
} from "./BranchToolbar.logic";
@@ -137,18 +136,13 @@ export function BranchToolbarBranchSelector({
);
const filteredBranchPickerItems = useMemo(
() =>
- filterBranchPickerItems({
- itemValues: branchPickerItems,
- normalizedQuery: normalizedDeferredBranchQuery,
- createBranchItemValue,
- checkoutPullRequestItemValue,
- }),
- [
- branchPickerItems,
- checkoutPullRequestItemValue,
- createBranchItemValue,
- normalizedDeferredBranchQuery,
- ],
+ normalizedDeferredBranchQuery.length === 0
+ ? branchPickerItems
+ : branchPickerItems.filter((itemValue) => {
+ if (createBranchItemValue && itemValue === createBranchItemValue) return true;
+ return itemValue.toLowerCase().includes(normalizedDeferredBranchQuery);
+ }),
+ [branchPickerItems, createBranchItemValue, normalizedDeferredBranchQuery],
);
const [resolvedActiveBranch, setOptimisticBranch] = useOptimistic(
canonicalActiveBranch,