11import type { TaskView , TaskStepView } from '../resources/tasks' ;
2- import { ExhaustiveSwitchCheck } from './types' ;
2+ import { type DeepMutable , ExhaustiveSwitchCheck } from './types' ;
33
44export 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