Skip to content

Commit 8eee676

Browse files
fix(mobile): bare @ in the composer lists workspace files
Mobile keeps its own composer path search, which also dropped an empty query, so a bare @ never requested workspace entries on iOS or Android. Search whenever a path trigger is active, keeping a null query as the inactive state. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0914e8c commit 8eee676

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

‎apps/mobile/src/state/queries.filesystem.test.ts‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const state = vi.hoisted(() => ({
77
phase: "connected" as "connected" | "offline",
88
sessionAtom: {},
99
searchAtom: {},
10+
searchRequests: vi.fn(),
1011
}));
1112

1213
vi.mock("react", async (importOriginal) => ({
@@ -27,7 +28,12 @@ vi.mock("./presentation", () => ({
2728
}));
2829
vi.mock("./pull-requests", () => ({ composerPullRequests: {} }));
2930
vi.mock("./projects", () => ({
30-
projectEnvironment: { searchEntries: () => state.searchAtom },
31+
projectEnvironment: {
32+
searchEntries: (target: unknown) => {
33+
state.searchRequests(target);
34+
return state.searchAtom;
35+
},
36+
},
3137
}));
3238
vi.mock("./atom-registry", () => ({ appAtomRegistry: {} }));
3339
vi.mock("./orchestration", () => ({ orchestrationEnvironment: {} }));
@@ -59,6 +65,7 @@ beforeEach(() => {
5965
state.session = null;
6066
state.sessionError = null;
6167
state.phase = "connected";
68+
state.searchRequests.mockClear();
6269
});
6370

6471
it("keeps a file search pending until its grant loads, then shows matches", () => {
@@ -74,3 +81,12 @@ it("keeps a file search pending until its grant loads, then shows matches", () =
7481
isPending: false,
7582
});
7683
});
84+
85+
it("searches workspace entries for a bare @", () => {
86+
state.session = { authenticated: true, scopes: [AuthFilesystemReadScope] };
87+
useComposerPathSearch({ ...target, query: "" });
88+
expect(state.searchRequests).toHaveBeenCalledExactlyOnceWith({
89+
environmentId: target.environmentId,
90+
input: { cwd: target.cwd, query: "", limit: 20 },
91+
});
92+
});

‎apps/mobile/src/state/queries.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ export function useComposerPathSearch(target: ComposerPathSearchTarget) {
426426
const searchTarget =
427427
debouncedTarget.environmentId !== null &&
428428
debouncedTarget.cwd !== null &&
429-
debouncedTarget.query.length > 0
429+
debouncedTarget.query !== null
430430
? {
431431
environmentId: debouncedTarget.environmentId,
432432
input: {

‎apps/mobile/src/state/queryTargets.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export interface CheckpointDiffTarget {
88
readonly ignoreWhitespace: boolean;
99
}
1010

11-
export function normalizeComposerPathSearchQuery(query: string | null): string {
12-
return query?.trim() ?? "";
11+
export function normalizeComposerPathSearchQuery(query: string | null): string | null {
12+
return query?.trim() ?? null;
1313
}
1414

1515
export function buildCheckpointDiffTargets(target: CheckpointDiffTarget) {

0 commit comments

Comments
 (0)