Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): return partial workspace index on timeout #11500

MergedMichel-Liao(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/11500/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 89 additions and 4 deletions.

x
0 of 2 viewed, 2 left
68 additions and 0 deletionsapps/server/src/workspace/WorkspaceSearchIndex.test.tsModified
View file
@@ -140,6 +140,74 @@
}),
​
+it.effect("returns partial path results when the initial scan times out", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const mixedSearch = vi.fn(() => ({
+ ok: true as const,
+ value: {
+ items: [
+ {
+ type: "directory" as const,
+ item: { relativePath: "src", fileName: "src", fileCount: 1 },
+ },
+ { type: "file" as const, item: fileItem("src/index.ts") },
+ ],
+ scores: [],
+ totalMatched: 2,
+ totalFiles: 1,
+ },
+ }));
+ let scanning = true;
+ const finder = {
+ destroy: vi.fn(),
+ isScanning: vi.fn(() => scanning),
+ waitForIndexReady: vi.fn(async () => ({ ok: true as const, value: false })),
+ mixedSearch,
+ } as unknown as FileFinder;
+ vi.spyOn(FileFinder, "create").mockReturnValueOnce({ ok: true, value: finder });