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 @@ -69,7 +69,7 @@ keyserverInfos[keyserverID] = { ...keyserverInfos[keyserverID], cookie }; } - state = { + return { ...state, keyserverInfos, }; @@ -102,27 +102,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 = { + ...keyserverInfos, + [keyserverID]: { + ...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, @@ -144,7 +147,7 @@ break; } } - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -161,7 +164,7 @@ action.payload.updatesResult.currentAsOf, state.keyserverInfos[keyserverID].updatesCurrentAsOf, ); - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -172,7 +175,7 @@ }, }; } else if (action.type === setURLPrefix) { - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -184,7 +187,7 @@ }; } else if (action.type === updateLastCommunicatedPlatformDetailsActionType) { const { keyserverID, platformDetails } = action.payload; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -207,7 +210,7 @@ }; } else if (action.type === updateConnectionStatusActionType) { const { keyserverID, status } = action.payload; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -223,7 +226,7 @@ }; } else if (action.type === unsupervisedBackgroundActionType) { const { keyserverID } = action.payload; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -260,7 +263,7 @@ ], }; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -288,7 +291,7 @@ }, }; } - state = { + return { ...state, keyserverInfos, }; @@ -306,7 +309,7 @@ }, }; - state = { + return { ...state, keyserverInfos, }; @@ -320,7 +323,7 @@ } else { lateResponsesSet.delete(messageID); } - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -335,7 +338,7 @@ }; } else if (action.type === updateDisconnectedBarActionType) { const { keyserverID } = action.payload; - state = { + return { ...state, keyserverInfos: { ...state.keyserverInfos, @@ -357,7 +360,7 @@ deviceToken: deviceTokens[keyserverID], }; } - state = { + return { ...state, keyserverInfos, };