@@ -305,17 +305,16 @@ export const VideoConfManager = new (class VideoConfManager extends Emitter<Vide
305
305
public updateUser ( ) : void {
306
306
const userId = Meteor . userId ( ) ;
307
307
308
- if ( this . userId === userId ) {
309
- this . debugLog ( `[VideoConf] Logged user has not changed, so we're not changing the hooks.` ) ;
310
- return ;
311
- }
312
-
313
- this . debugLog ( `[VideoConf] Logged user has changed.` ) ;
308
+ this . debugLog ( `[VideoConf] Logged user or connection status has changed.` ) ;
314
309
315
310
if ( this . userId ) {
316
- this . disconnect ( ) ;
311
+ this . disconnect ( this . userId !== userId ) ;
317
312
}
318
313
314
+ if ( ! Meteor . status ( ) . connected || ( userId && Meteor . loggingIn ( ) ) ) {
315
+ this . debugLog ( `[VideoConf] Connection lost or login process still pending, skipping user change.` ) ;
316
+ return ;
317
+ }
319
318
if ( userId ) {
320
319
this . connectUser ( userId ) ;
321
320
}
@@ -458,12 +457,17 @@ export const VideoConfManager = new (class VideoConfManager extends Emitter<Vide
458
457
sdk . rest . post ( '/v1/video-conference.cancel' , { callId } ) ;
459
458
}
460
459
461
- private disconnect ( ) : void {
460
+ private disconnect ( clearCalls = true ) : void {
462
461
console . log ( `[VideoConf] disconnecting user ${ this . userId } ` ) ;
463
462
for ( const hook of this . hooks ) {
464
463
hook ( ) ;
465
464
}
466
465
this . hooks = [ ] ;
466
+ this . userId = undefined ;
467
+
468
+ if ( ! clearCalls ) {
469
+ return ;
470
+ }
467
471
468
472
if ( this . currentCallHandler ) {
469
473
clearInterval ( this . currentCallHandler ) ;
@@ -478,7 +482,6 @@ export const VideoConfManager = new (class VideoConfManager extends Emitter<Vide
478
482
clearTimeout ( call . acceptTimeout ) ;
479
483
}
480
484
} ) ;
481
- this . userId = undefined ;
482
485
this . incomingDirectCalls . clear ( ) ;
483
486
this . dismissedCalls . clear ( ) ;
484
487
this . currentCallData = undefined ;
0 commit comments