diff --git a/lib/reducers/integrity-reducer.js b/lib/reducers/integrity-reducer.js --- a/lib/reducers/integrity-reducer.js +++ b/lib/reducers/integrity-reducer.js @@ -9,6 +9,7 @@ keyserverRegisterActionTypes, } from '../actions/user-actions.js'; import { extractKeyserverIDFromID } from '../keyserver-conn/keyserver-call-utils.js'; +import { integrityStoreOpsHandlers } from '../ops/integrity-store-ops.js'; import type { ThreadStoreOperation } from '../ops/thread-store-ops'; import type { IntegrityStore } from '../types/integrity-types'; import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; @@ -16,6 +17,8 @@ import { fullStateSyncActionType } from '../types/socket-types.js'; import { hash } from '../utils/objects.js'; +const { processStoreOperations: processStoreOps } = integrityStoreOpsHandlers; + function reduceIntegrityStore( state: IntegrityStore, action: BaseAction, @@ -51,14 +54,12 @@ .filter(([, info]) => !!info) .map(([id, info]) => [id, hash(info)]), ); - - newState = { - ...newState, - threadHashes: { - ...newState.threadHashes, - ...newThreadHashes, - }, + const replaceOperation = { + type: 'replace_integrity_thread_hashes', + payload: { threadHashes: newThreadHashes }, }; + + newState = processStoreOps(state, [replaceOperation]); } if (action.payload.threadHashingStatus) { newState = {