@@ -1479,60 +1479,67 @@ const connectWithOptions = (
1479
1479
return inflightConnection ;
1480
1480
}
1481
1481
inflightConnection = ( async ( ) => {
1482
- const isAutoconnectAttempt = isAutoconnectInfo (
1483
- getState ( ) ,
1484
- connectionInfo . id
1485
- ) ;
1486
-
1487
1482
const deviceAuthAbortController = new AbortController ( ) ;
1488
1483
1489
- connectionInfo = cloneDeep ( connectionInfo ) ;
1484
+ try {
1485
+ if (
1486
+ getCurrentConnectionStatus ( getState ( ) , connectionInfo . id ) ===
1487
+ 'connected'
1488
+ ) {
1489
+ return ;
1490
+ }
1490
1491
1491
- const {
1492
- forceConnectionOptions,
1493
- browserCommandForOIDCAuth,
1494
- maximumNumberOfActiveConnections,
1495
- telemetryAnonymousId,
1496
- } = preferences . getPreferences ( ) ;
1492
+ const isAutoconnectAttempt = isAutoconnectInfo (
1493
+ getState ( ) ,
1494
+ connectionInfo . id
1495
+ ) ;
1497
1496
1498
- const connectionProgress = getNotificationTriggers ( ) ;
1497
+ connectionInfo = cloneDeep ( connectionInfo ) ;
1499
1498
1500
- if (
1501
- typeof maximumNumberOfActiveConnections !== 'undefined' &&
1502
- getActiveConnectionsCount ( getState ( ) . connections ) >=
1503
- maximumNumberOfActiveConnections
1504
- ) {
1505
- connectionProgress . openMaximumConnectionsReachedToast (
1506
- maximumNumberOfActiveConnections
1507
- ) ;
1508
- return ;
1509
- }
1499
+ const {
1500
+ forceConnectionOptions,
1501
+ browserCommandForOIDCAuth,
1502
+ maximumNumberOfActiveConnections,
1503
+ telemetryAnonymousId,
1504
+ } = preferences . getPreferences ( ) ;
1510
1505
1511
- dispatch ( {
1512
- type : ActionTypes . ConnectionAttemptStart ,
1513
- connectionInfo,
1514
- options : { forceSave : options . forceSave } ,
1515
- } ) ;
1506
+ const connectionProgress = getNotificationTriggers ( ) ;
1516
1507
1517
- track (
1518
- 'Connection Attempt' ,
1519
- {
1520
- is_favorite : connectionInfo . savedConnectionType === 'favorite' ,
1521
- is_new : isNewConnection ( getState ( ) , connectionInfo . id ) ,
1522
- } ,
1523
- connectionInfo
1524
- ) ;
1508
+ if (
1509
+ typeof maximumNumberOfActiveConnections !== 'undefined' &&
1510
+ getActiveConnectionsCount ( getState ( ) . connections ) >=
1511
+ maximumNumberOfActiveConnections
1512
+ ) {
1513
+ connectionProgress . openMaximumConnectionsReachedToast (
1514
+ maximumNumberOfActiveConnections
1515
+ ) ;
1516
+ return ;
1517
+ }
1525
1518
1526
- debug ( 'connecting with connectionInfo' , connectionInfo ) ;
1519
+ dispatch ( {
1520
+ type : ActionTypes . ConnectionAttemptStart ,
1521
+ connectionInfo,
1522
+ options : { forceSave : options . forceSave } ,
1523
+ } ) ;
1527
1524
1528
- log . info (
1529
- mongoLogId ( 1_001_000_004 ) ,
1530
- 'Connection UI' ,
1531
- 'Initiating connection attempt' ,
1532
- { isAutoconnectAttempt }
1533
- ) ;
1525
+ track (
1526
+ 'Connection Attempt' ,
1527
+ {
1528
+ is_favorite : connectionInfo . savedConnectionType === 'favorite' ,
1529
+ is_new : isNewConnection ( getState ( ) , connectionInfo . id ) ,
1530
+ } ,
1531
+ connectionInfo
1532
+ ) ;
1533
+
1534
+ debug ( 'connecting with connectionInfo' , connectionInfo ) ;
1535
+
1536
+ log . info (
1537
+ mongoLogId ( 1_001_000_004 ) ,
1538
+ 'Connection UI' ,
1539
+ 'Initiating connection attempt' ,
1540
+ { isAutoconnectAttempt }
1541
+ ) ;
1534
1542
1535
- try {
1536
1543
// Connection form allows to start connecting with invalid connection
1537
1544
// strings, so throw fast if it's not valid before doing anything else
1538
1545
ensureWellFormedConnectionString (
0 commit comments