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 && ( {