File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
packages/app/src/app/overmind/namespaces/live Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -460,14 +460,23 @@ export const onOperation: Operator<LiveMessage<{
460460export const onConnectionLoss : Operator < LiveMessage > = mutate (
461461 async ( { state, effects } ) => {
462462 if ( ! state . live . reconnecting ) {
463- const id = effects . notificationToast . add ( {
464- message : 'We lost connection with the live server, reconnecting...' ,
465- status : NotificationStatus . ERROR ,
466- } ) ;
463+ let notificationId : string ;
464+ const timeout = setTimeout ( ( ) => {
465+ notificationId = effects . notificationToast . add ( {
466+ message : 'We lost connection with the live server, reconnecting...' ,
467+ status : NotificationStatus . ERROR ,
468+ } ) ;
469+ } , 500 ) ;
470+
467471 state . live . reconnecting = true ;
468472
469473 await effects . flows . waitUntil ( s => s . live . reconnecting === false ) ;
470- effects . notificationToast . remove ( id ) ;
474+ if ( notificationId ) {
475+ effects . notificationToast . remove ( notificationId ) ;
476+ }
477+ if ( timeout ) {
478+ clearTimeout ( timeout ) ;
479+ }
471480 }
472481 }
473482) ;
You can’t perform that action at this time.
0 commit comments