diff --git a/lib/reducers/invite-links-reducer.js b/lib/reducers/invite-links-reducer.js --- a/lib/reducers/invite-links-reducer.js +++ b/lib/reducers/invite-links-reducer.js @@ -9,6 +9,7 @@ deleteKeyserverAccountActionTypes, logOutActionTypes, } from '../actions/user-actions.js'; +import { extractKeyserverIDFromID } from '../keyserver-conn/keyserver-call-utils.js'; import { setNewSessionActionType } from '../keyserver-conn/keyserver-conn-types.js'; import type { InviteLinksStore, CommunityLinks } from '../types/link-types.js'; import type { BaseAction } from '../types/redux-types.js'; @@ -60,9 +61,22 @@ }; } else if ( action.type === logOutActionTypes.success || - action.type === deleteKeyserverAccountActionTypes.success || - (action.type === setNewSessionActionType && - action.payload.sessionChange.cookieInvalidated) + action.type === deleteKeyserverAccountActionTypes.success + ) { + const keyserverIDsSet = new Set(action.payload.keyserverIDs); + const newLinks: { [communityID: string]: CommunityLinks } = {}; + for (const linkID in state.links) { + if (!keyserverIDsSet.has(extractKeyserverIDFromID(linkID))) { + newLinks[linkID] = state.links[linkID]; + } + } + return { + ...state, + links: newLinks, + }; + } else if ( + action.type === setNewSessionActionType && + action.payload.sessionChange.cookieInvalidated ) { return { links: {},