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 @@ -8,6 +8,7 @@ logInActionTypes, keyserverRegisterActionTypes, } from '../actions/user-actions.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'; @@ -15,6 +16,8 @@ import { fullStateSyncActionType } from '../types/socket-types.js'; import { hash } from '../utils/objects.js'; +const { processStoreOperations: processStoreOps } = integrityStoreOpsHandlers; + function reduceIntegrityStore( state: IntegrityStore, action: BaseAction, @@ -45,14 +48,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 = {