From 0953468b5c8ab087932d657541ca0af62aa48968 Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Wed, 16 Jul 2025 17:49:17 -0700 Subject: [PATCH] fix: Fix exposing explicit search button in gh branch dropdown (#435) * fix: Fix exposing explicit search button in gh branch dropdown * cr --- .../repo-branch-selectors/branch-selector.tsx | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/apps/web/src/components/github/repo-branch-selectors/branch-selector.tsx b/apps/web/src/components/github/repo-branch-selectors/branch-selector.tsx index 383bd8ee..23754fae 100644 --- a/apps/web/src/components/github/repo-branch-selectors/branch-selector.tsx +++ b/apps/web/src/components/github/repo-branch-selectors/branch-selector.tsx @@ -20,6 +20,7 @@ import { GitBranch, Shield } from "lucide-react"; import { TargetRepository } from "@open-swe/shared/open-swe/types"; import { Branch } from "@/utils/github"; import { toast } from "sonner"; +import { defaultFilter } from "cmdk"; interface BranchSelectorProps { disabled?: boolean; @@ -123,6 +124,14 @@ export function BranchSelector({ } }; + // Whether or not to allow explicitly searching for a branch, even when there are results. + const allowExplicitSearchReqWithResults = !!( + searchQuery.trim() && + branches.some( + (branch) => defaultFilter(branch.name, searchQuery.trim()) > 0, + ) + ); + if (!selectedRepository) { return ( - - )} - {branchesHasMore && ( + {allowExplicitSearchReqWithResults && ( +
+ +
+ )} + {branchesHasMore && !allowExplicitSearchReqWithResults && ( {