Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): refresh Changes totals after remote polls #28600

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/28600/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 77 additions and 29 deletions.

x
0 of 2 viewed, 2 left
74 additions and 16 deletionsapps/server/src/vcs/VcsStatusBroadcaster.test.tsModified
View file
@@ -656,9 +656,12 @@
​
- it.effect("an explicit refresh reads local totals after the fetch", () => {
+ it.effect("a remote poll refreshes Changes totals when divergence counts stay the same", () => {
const state: Parameters<typeof layerTestFor>[0] = {
- currentLocalStatus: baseLocalStatus,
+ currentLocalStatus: {
+ ...baseLocalStatus,
+ branchChanges: { baseRef: "origin/main", insertions: 745, deletions: 24 },
+ },
currentRemoteStatus: baseRemoteStatus,
localStatusCalls: 0,
remoteStatusCalls: 0,
@@ -668,24 +671,79 @@
​
return Effect.gen(function* () {
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
- const fetchStarted = yield* Deferred.make<void>();
- const finishFetch = yield* Deferred.make<void>();
- state.beforeRemoteStatus = Deferred.succeed(fetchStarted, undefined).pipe(
- Effect.andThen(Deferred.await(finishFetch)),
+ yield* broadcaster.getStatus({ cwd: "/repo" });
+ const subscribed = yield* Deferred.make<void>();
+ const polled = yield* Deferred.make<void>();
+ yield* broadcaster.streamStatus({ cwd: "/repo" }).pipe(
+ Stream.runForEach((event) => {
+ if (event._tag === "snapshot") return Deferred.succeed(subscribed, undefined);