Skip to content

Commit cf67969

Browse files
committed
Update stream.ts
1 parent 19ef3bb commit cf67969

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/lib/stream.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { TaskView, TaskStepView } from '../resources/tasks';
2-
import { ExhaustiveSwitchCheck } from './types';
2+
import { type DeepMutable, ExhaustiveSwitchCheck } from './types';
33

44
export type ReducerEvent = TaskView | null;
55

@@ -39,10 +39,10 @@ export function reducer(state: BrowserState, action: BrowserAction): [BrowserSta
3939

4040
// UPDATE
4141

42-
const liveUrl = action.status.sessionLiveUrl ?? null;
43-
const doneOutput = action.status.doneOutput ?? null;
44-
const steps: TaskStepView[] = [...state.steps];
42+
const liveUrl = action.status.sessionLiveUrl ?? state.liveUrl;
43+
const doneOutput = action.status.doneOutput ?? state.doneOutput;
4544

45+
const steps: TaskStepView[] = [...state.steps];
4646
if (action.status.steps != null) {
4747
const newSteps = action.status.steps.slice(state.steps.length);
4848

@@ -51,7 +51,7 @@ export function reducer(state: BrowserState, action: BrowserAction): [BrowserSta
5151
}
5252
}
5353

54-
const newState: BrowserState = {
54+
const newState: DeepMutable<BrowserState> = {
5555
...state,
5656
liveUrl,
5757
steps,
@@ -67,9 +67,9 @@ export function reducer(state: BrowserState, action: BrowserAction): [BrowserSta
6767
) {
6868
const update: ReducerEvent = {
6969
...action.status,
70-
steps: steps,
71-
sessionLiveUrl: liveUrl,
72-
doneOutput: doneOutput,
70+
steps: newState.steps,
71+
sessionLiveUrl: newState.liveUrl,
72+
doneOutput: newState.doneOutput,
7373
};
7474

7575
return [newState, update];

0 commit comments

Comments
 (0)