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 @@ -27,7 +27,7 @@ type KeyserverStoreOperation, } from '../ops/keyserver-store-ops.js'; import { queueActivityUpdatesActionType } from '../types/activity-types.js'; -import type { KeyserverInfos, KeyserverStore } from '../types/keyserver-types'; +import type { KeyserverStore } from '../types/keyserver-types'; import type { BaseAction } from '../types/redux-types.js'; import { fullStateSyncActionType, @@ -462,16 +462,22 @@ }; } else if (action.type === setDeviceTokenActionTypes.success) { const { deviceTokens } = action.payload; - const keyserverInfos: { ...KeyserverInfos } = { ...state.keyserverInfos }; + const operations: ReplaceKeyserverOperation[] = []; for (const keyserverID in deviceTokens) { - keyserverInfos[keyserverID] = { - ...keyserverInfos[keyserverID], - deviceToken: deviceTokens[keyserverID], - }; + operations.push({ + type: 'replace_keyserver', + payload: { + id: keyserverID, + keyserverInfo: { + ...state.keyserverInfos[keyserverID], + deviceToken: deviceTokens[keyserverID], + }, + }, + }); } return { ...state, - keyserverInfos, + keyserverInfos: processStoreOps(state.keyserverInfos, operations), }; } else if (action.type === setConnectionIssueActionType) { const { connectionIssue, keyserverID } = action.payload;