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 @@ -22,36 +22,10 @@ fullStateSyncActionType, stateSyncPayloadTypes, } from '../types/socket-types.js'; -import { getMessageForException } from '../utils/errors.js'; -import { assertObjectsAreEqual, hash } from '../utils/objects.js'; +import { hash } from '../utils/objects.js'; const { processStoreOperations: processStoreOps } = integrityStoreOpsHandlers; -function assertIntegrityStoresAreEqual( - processedIntegrityStore: ThreadHashes, - expectedIntegrityStore: ThreadHashes, - location: string, - onStateDifference?: (message: string) => mixed, -) { - try { - assertObjectsAreEqual( - processedIntegrityStore, - expectedIntegrityStore, - `ThreadHashes - ${location}`, - ); - } catch (e) { - console.log( - 'Error processing IntegrityStore ops', - processedIntegrityStore, - expectedIntegrityStore, - ); - const message = `Error processing IntegrityStore ops ${ - getMessageForException(e) ?? '{no exception message}' - }`; - onStateDifference?.(message); - } -} - function reduceIntegrityStore( state: IntegrityStore, action: BaseAction, @@ -112,14 +86,22 @@ integrityStoreOperations: [], }; } else if (action.type === setClientDBStoreActionType) { - assertIntegrityStoresAreEqual( - action.payload.threadHashes ?? {}, - state.threadHashes, - action.type, - onStateDifference, - ); + const newThreadHashes = action.payload.threadHashes; + + if (!newThreadHashes) { + return { + integrityStore: state, + integrityStoreOperations: [], + }; + } + + const newIntegrityStore: IntegrityStore = { + ...state, + threadHashes: newThreadHashes, + }; + return { - integrityStore: state, + integrityStore: newIntegrityStore, integrityStoreOperations: [], }; } diff --git a/native/redux/handle-redux-migration-failure.js b/native/redux/handle-redux-migration-failure.js --- a/native/redux/handle-redux-migration-failure.js +++ b/native/redux/handle-redux-migration-failure.js @@ -22,6 +22,7 @@ 'auxUserStore', 'commServicesAccessToken', 'inviteLinksStore', + 'integrityStore', ]; function handleReduxMigrationFailure(oldState: AppState): AppState {