Skip to content

Commit 25f5d01

Browse files
Bil0000codex
andcommitted
fix(mobile): filter branch names from raw search text
Co-Authored-By: GPT-6 Sol <[email protected]>
1 parent f0d9988 commit 25f5d01

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎apps/mobile/src/features/threads/new-task-context-presentation.test.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { describe, expect, it } from "vite-plus/test";
22

3-
import { sanitizeNewRefName } from "@t3tools/shared/git";
4-
53
import {
64
filterNewTaskBranches,
75
resolveNewTaskBranchWorktreePath,
@@ -137,7 +135,7 @@ describe("filterNewTaskBranches", () => {
137135
{ name: "origin/fix/remote-only", isRemote: true },
138136
];
139137
const search = (query: string) =>
140-
filterNewTaskBranches(branches, sanitizeNewRefName(query)).map((branch) => branch.name);
138+
filterNewTaskBranches(branches, query).map((branch) => branch.name);
141139

142140
it("ignores case in both the query and the branch name", () => {
143141
expect(search("feature/login")).toEqual(["Feature/Login-Page"]);

‎apps/mobile/src/features/threads/new-task-context-presentation.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { sanitizeNewRefName } from "@t3tools/shared/git";
2+
13
type WorkspaceMode = "local" | "worktree";
24

35
export function resolveNewTaskWorkspaceLabel(input: {
@@ -84,9 +86,9 @@ export function shouldCheckoutNewTaskBranch(input: {
8486

8587
export function filterNewTaskBranches<T extends { readonly name: string }>(
8688
branches: ReadonlyArray<T>,
87-
sanitizedQuery: string,
89+
rawQuery: string,
8890
): ReadonlyArray<T> {
89-
const query = sanitizedQuery.toLowerCase();
91+
const query = sanitizeNewRefName(rawQuery).toLowerCase();
9092
return query.length === 0
9193
? branches
9294
: branches.filter((branch) => branch.name.toLowerCase().includes(query));

‎apps/mobile/src/features/threads/new-task-flow-provider.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,8 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
676676
const currentCheckoutBranchName = projectGitStatus.data?.refName ?? null;
677677

678678
const filteredBranches = useMemo(
679-
() => filterNewTaskBranches(allBranchRefs, branchSearchQuery),
680-
[allBranchRefs, branchSearchQuery],
679+
() => filterNewTaskBranches(allBranchRefs, branchQuery),
680+
[allBranchRefs, branchQuery],
681681
);
682682

683683
// The composer's draft follows the project it will be sent to: switching

0 commit comments

Comments
 (0)