@@ -624,28 +624,28 @@ export const workspaceMachine = createMachine(
624
624
throw Error ( "Cannot cancel workspace without build id" )
625
625
}
626
626
} ,
627
- listenForEvents : ( context ) => ( callback ) => {
627
+ listenForEvents : ( context ) => ( send ) => {
628
628
if ( ! context . sse ) {
629
- callback ( { type : "SSE_ERROR" , error : "error initializing sse" } )
629
+ send ( { type : "SSE_ERROR" , error : "error initializing sse" } )
630
630
return
631
631
}
632
632
633
633
context . sse . addEventListener ( "data" , ( event ) => {
634
634
// update our data objects (workspace, resources) with each SSE that comes back from the server
635
- callback ( { type : "UPDATE_EVENT" , data : JSON . parse ( event . data ) } )
635
+ send ( { type : "UPDATE_EVENT" , data : JSON . parse ( event . data ) } )
636
636
// refresh our timeline
637
- callback ( { type : "CHECK_REFRESH_TIMELINE" , data : JSON . parse ( event . data ) } )
637
+ send ( { type : "CHECK_REFRESH_TIMELINE" , data : JSON . parse ( event . data ) } )
638
638
} )
639
639
640
640
// handle any error events returned by our sse
641
641
context . sse . addEventListener ( "error" , ( event ) => {
642
- callback ( { type : "SSE_ERROR" , error : event } )
642
+ send ( { type : "SSE_ERROR" , error : event } )
643
643
} )
644
644
645
645
// handle any sse implementation exceptions
646
646
context . sse . onerror = ( ) => {
647
647
context . sse && context . sse . close ( ) ;
648
- callback ( { type : "SSE_ERROR" , error : "sse error" } )
648
+ send ( { type : "SSE_ERROR" , error : "sse error" } )
649
649
}
650
650
651
651
} ,
0 commit comments