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 @@ -75,20 +75,26 @@ keyserverInfos, }; } else if (action.type === setNewSessionActionType) { - const { keyserverID } = action.payload; - if (action.payload.sessionChange.cookie !== undefined) { + const { keyserverID, sessionChange } = action.payload; + if ( + !state.keyserverInfos[keyserverID] && + sessionChange.cookie?.startsWith('anonymous=') + ) { + return state; + } + if (sessionChange.cookie !== undefined) { state = { ...state, keyserverInfos: { ...state.keyserverInfos, [keyserverID]: { ...state.keyserverInfos[keyserverID], - cookie: action.payload.sessionChange.cookie, + cookie: sessionChange.cookie, }, }, }; } - if (action.payload.sessionChange.cookieInvalidated) { + if (sessionChange.cookieInvalidated) { state = { ...state, keyserverInfos: { diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js --- a/web/redux/redux-setup.js +++ b/web/redux/redux-setup.js @@ -164,12 +164,18 @@ storeOperations, ); } else if (action.type === setNewSessionActionType) { - const { keyserverID } = action.payload; + const { keyserverID, sessionChange } = action.payload; + if ( + !state.keyserverStore.keyserverInfos[keyserverID] && + sessionChange.cookie?.startsWith('anonymous=') + ) { + return state; + } if ( invalidSessionDowngrade( oldState, - action.payload.sessionChange.currentUserInfo, + sessionChange.currentUserInfo, action.payload.preRequestUserState, keyserverID, ) @@ -188,7 +194,7 @@ ...state.keyserverStore.keyserverInfos, [keyserverID]: { ...state.keyserverStore.keyserverInfos[keyserverID], - sessionID: action.payload.sessionChange.sessionID, + sessionID: sessionChange.sessionID, }, }, },