Skip to content

Commit 4414f92

Browse files
Clear VCS presentation state on finish (#3764)
1 parent 6e42231 commit 4414f92

2 files changed

Lines changed: 41 additions & 3 deletions

File tree

packages/client-runtime/src/state/vcsAction.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,46 @@ describe("vcsActionState", () => {
155155
});
156156
});
157157

158+
it("clears running presentation state once the action finishes", () => {
159+
const initial = beginVcsActionState({
160+
operation: "run_change_request",
161+
label: "Running source control action",
162+
actionId,
163+
});
164+
const pushing = applyVcsActionProgressEvent(
165+
initial,
166+
progress({
167+
actionId,
168+
action,
169+
cwd,
170+
kind: "phase_started",
171+
phase: "push",
172+
label: "Pushing...",
173+
}),
174+
);
175+
const finished = applyVcsActionProgressEvent(
176+
pushing,
177+
progress({
178+
actionId,
179+
action,
180+
cwd,
181+
kind: "action_finished",
182+
result,
183+
}),
184+
);
185+
186+
expect(finished).toMatchObject({
187+
isRunning: false,
188+
operation: "run_change_request",
189+
actionId,
190+
action,
191+
currentLabel: null,
192+
currentPhaseLabel: null,
193+
lastOutputLine: null,
194+
error: null,
195+
});
196+
});
197+
158198
it("retains a terminal action error for presentation", () => {
159199
const initial = beginVcsActionState({
160200
operation: "run_change_request",

packages/client-runtime/src/state/vcsAction.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,10 @@ export function applyVcsActionProgressEvent(
386386
};
387387
case "action_finished":
388388
return {
389-
...current,
390-
isRunning: false,
389+
...EMPTY_VCS_ACTION_STATE,
391390
actionId: event.actionId,
392391
action: event.action,
393392
operation: "run_change_request",
394-
error: null,
395393
};
396394
case "action_failed":
397395
return {

0 commit comments

Comments
 (0)