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 @@ -110,34 +110,41 @@ } return state; } + + let newKeyserverInfo = { + ...state.keyserverInfos[keyserverID], + }; + if (sessionChange.cookie !== undefined) { - state = { - ...state, - keyserverInfos: { - ...state.keyserverInfos, - [keyserverID]: { - ...state.keyserverInfos[keyserverID], - cookie: sessionChange.cookie, - }, - }, + newKeyserverInfo = { + ...newKeyserverInfo, + cookie: sessionChange.cookie, }; } if (sessionChange.cookieInvalidated) { - state = { - ...state, - keyserverInfos: { - ...state.keyserverInfos, - [keyserverID]: { - ...state.keyserverInfos[keyserverID], - connection: { - ...state.keyserverInfos[keyserverID].connection, - queuedActivityUpdates: [], - }, - }, + newKeyserverInfo = { + ...newKeyserverInfo, + connection: { + ...state.keyserverInfos[keyserverID].connection, + queuedActivityUpdates: [], }, }; } - return state; + + const operations: ReplaceKeyserverOperation[] = [ + { + type: 'replace_keyserver', + payload: { + id: keyserverID, + keyserverInfo: newKeyserverInfo, + }, + }, + ]; + + return { + ...state, + keyserverInfos: processStoreOps(state.keyserverInfos, operations), + }; } else if ( action.type === logInActionTypes.success || action.type === siweAuthActionTypes.success ||