11import type AppRegistry from '@mongodb-js/compass-app-registry' ;
2- import type { Reducer , AnyAction , Action } from 'redux' ;
2+ import type { Reducer , AnyAction , Action , DeepPartial } from 'redux' ;
33import { createStore , applyMiddleware } from 'redux' ;
44import type { ThunkAction } from 'redux-thunk' ;
55import thunk from 'redux-thunk' ;
@@ -1617,35 +1617,38 @@ const connectWithOptions = (
16171617 const { connectionOptions, ...restOfTheConnectionInfo } =
16181618 connectionInfo ;
16191619
1620- const adjustedConnectionInfoForConnection : ConnectionInfo = merge (
1621- cloneDeep ( restOfTheConnectionInfo ) ,
1622- {
1623- connectionOptions : adjustConnectionOptionsBeforeConnect ( {
1624- connectionOptions : merge (
1625- cloneDeep ( connectionOptions ) ,
1626- SecretsForConnection . get ( connectionInfo . id ) ?? { }
1627- ) ,
1628- connectionId : connectionInfo . id ,
1629- defaultAppName : appName ,
1630- preferences : {
1631- forceConnectionOptions : forceConnectionOptions ?? [ ] ,
1632- browserCommandForOIDCAuth,
1633- telemetryAnonymousId,
1634- } ,
1635- notifyDeviceFlow : ( deviceFlowInfo ) => {
1636- connectionProgress . openNotifyDeviceAuthModal (
1637- connectionInfo ,
1638- deviceFlowInfo . verificationUrl ,
1639- deviceFlowInfo . userCode ,
1640- ( ) => {
1641- void dispatch ( disconnect ( connectionInfo . id ) ) ;
1642- } ,
1643- deviceAuthAbortController . signal
1644- ) ;
1645- } ,
1646- } ) ,
1647- }
1648- ) ;
1620+ const adjustedConnectionInfoForConnection : ConnectionInfo = merge <
1621+ Omit < ConnectionInfo , 'connectionOptions' > ,
1622+ Pick < ConnectionInfo , 'connectionOptions' >
1623+ > ( cloneDeep ( restOfTheConnectionInfo ) , {
1624+ connectionOptions : adjustConnectionOptionsBeforeConnect ( {
1625+ connectionOptions : merge <
1626+ ConnectionOptions ,
1627+ DeepPartial < ConnectionOptions >
1628+ > (
1629+ cloneDeep ( connectionOptions ) ,
1630+ SecretsForConnection . get ( connectionInfo . id ) ?? { }
1631+ ) ,
1632+ connectionId : connectionInfo . id ,
1633+ defaultAppName : appName ,
1634+ preferences : {
1635+ forceConnectionOptions : forceConnectionOptions ?? [ ] ,
1636+ browserCommandForOIDCAuth,
1637+ telemetryAnonymousId,
1638+ } ,
1639+ notifyDeviceFlow : ( deviceFlowInfo ) => {
1640+ connectionProgress . openNotifyDeviceAuthModal (
1641+ connectionInfo ,
1642+ deviceFlowInfo . verificationUrl ,
1643+ deviceFlowInfo . userCode ,
1644+ ( ) => {
1645+ void dispatch ( disconnect ( connectionInfo . id ) ) ;
1646+ } ,
1647+ deviceAuthAbortController . signal
1648+ ) ;
1649+ } ,
1650+ } ) ,
1651+ } ) ;
16491652
16501653 // Temporarily disable Atlas Streams connections until https://jira.mongodb.org/browse/STREAMS-862
16511654 // is done.
@@ -1765,7 +1768,10 @@ const connectWithOptions = (
17651768 }
17661769 void dispatch (
17671770 saveConnectionInfo (
1768- merge ( cloneDeep ( info ) , { connectionOptions : secrets } )
1771+ merge < ConnectionInfo , DeepPartial < ConnectionInfo > > (
1772+ cloneDeep ( info ) ,
1773+ { connectionOptions : secrets }
1774+ )
17691775 )
17701776 ) ;
17711777 } ,
@@ -1784,7 +1790,7 @@ const connectWithOptions = (
17841790 try {
17851791 await dispatch (
17861792 saveConnectionInfo (
1787- merge (
1793+ merge < ConnectionInfo | undefined , DeepPartial < ConnectionInfo > > (
17881794 cloneDeep (
17891795 // See `ConnectionAttemptStartAction` handler in the reducer:
17901796 // in case of existing connection from storage, we keep the
0 commit comments