diff --git a/lib/reducers/keyserver-reducer.js b/lib/reducers/keyserver-reducer.js --- a/lib/reducers/keyserver-reducer.js +++ b/lib/reducers/keyserver-reducer.js @@ -57,7 +57,7 @@ keyserverInfos[keyserverID] = { ...keyserverInfos[keyserverID], cookie }; } - state = { + return { ...state, keyserverInfos, }; @@ -90,27 +90,30 @@ }, }; } + return state; } else if ( action.type === logInActionTypes.success || action.type === siweAuthActionTypes.success ) { const { updatesCurrentAsOf } = action.payload; + let keyserverInfos = { ...state.keyserverInfos }; for (const keyserverID in updatesCurrentAsOf) { - state = { - ...state, - keyserverInfos: { - ...state.keyserverInfos, - [keyserverID]: { - ...state.keyserverInfos[keyserverID], - updatesCurrentAsOf: updatesCurrentAsOf[keyserverID], - lastCommunicatedPlatformDetails: getConfig().platformDetails, - }, + keyserverInfos = { + ...state.keyserverInfos, + [keyserverID]: { + ...state.keyserverInfos[keyserverID], + updatesCurrentAsOf: updatesCurrentAsOf[keyserverID], + lastCommunicatedPlatformDetails: getConfig().platformDetails, }, }; } + return { + ...state, + keyserverInfos, + }; } else if (action.type === fullStateSyncActionType) { const { keyserverID } = action.payload; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -132,7 +135,7 @@ break; } } - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -149,7 +152,7 @@ action.payload.updatesResult.currentAsOf, state.keyserverInfos[ashoatKeyserverID].updatesCurrentAsOf, ); - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -160,7 +163,7 @@ }, }; } else if (action.type === setURLPrefix) { - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -172,7 +175,7 @@ }; } else if (action.type === updateLastCommunicatedPlatformDetailsActionType) { const { keyserverID } = action.payload; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -184,7 +187,7 @@ }; } else if (action.type === updateConnectionStatusActionType) { const { keyserverID, status } = action.payload; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -200,7 +203,7 @@ }; } else if (action.type === unsupervisedBackgroundActionType) { const { keyserverID } = action.payload; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -237,7 +240,7 @@ ], }; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -265,7 +268,7 @@ }, }; } - state = { + return { ...state, keyserverInfos, }; @@ -283,7 +286,7 @@ }, }; - state = { + return { ...state, keyserverInfos, }; @@ -297,7 +300,7 @@ } else { lateResponsesSet.delete(messageID); } - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -312,7 +315,7 @@ }; } else if (action.type === updateDisconnectedBarActionType) { const { keyserverID } = action.payload; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -334,7 +337,7 @@ deviceToken: deviceTokens[keyserverID], }; } - state = { + return { ...state, keyserverInfos, };