Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): branch picker lists refs without rebuilding them per keystroke #26941

Closedhieu-lee(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/26941/headopened View on GitHub

Showing 2 changed files with 53 additions and 0 deletions (loading 1).

x
0 of 2 viewed, 2 left
53 additions and 0 deletionsapps/server/src/vcs/GitVcsDriverCore.test.tsModified
View file
@@ -765,6 +765,29 @@
).pipe(Effect.provide(layerTest)),
​
+it.effect("searches and pages a branch created outside the driver after refs were cached", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const cwd = yield* makeTmpDir();
+ yield* initRepoWithCommit(cwd);
+ const driver = yield* GitVcsDriver.GitVcsDriver;
+ yield* driver.listRefs({ cwd });
+ yield* git(cwd, ["switch", "-c", "feature/outside"]);
+​
+ const searched = yield* driver.listRefs({ cwd, query: "OUTSIDE" });
+ assert.deepEqual(
+ searched.refs.map((ref) => [ref.name, ref.current]),
+ [["feature/outside", true]],
+ );
+ assert.equal(searched.totalCount, 1);
+ const first = yield* driver.listRefs({ cwd, limit: 1 });
+ assert.equal(first.refs[0]?.name, "feature/outside");
+ assert.equal(first.totalCount, 2);
+ assert.equal(first.nextCursor, 1);
+ }),
+ ).pipe(Effect.provide(layerTest)),
+);
+​
it.effect.each(["on a branch", "detached", "unborn"] as const)(
"reads only the repository root for review requests that ignore the branch when %s",
(state) =>