Page MenuHomePhabricator

D12686.id42779.diff
No OneTemporary

D12686.id42779.diff

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,40 +22,13 @@
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,
- onStateDifference?: (message: string) => mixed,
threadInfos: {
+[string]: RawThreadInfo,
},
@@ -112,14 +85,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/lib/reducers/integrity-reducer.test.js b/lib/reducers/integrity-reducer.test.js
--- a/lib/reducers/integrity-reducer.test.js
+++ b/lib/reducers/integrity-reducer.test.js
@@ -96,7 +96,6 @@
reduceIntegrityStore(
oldIntegrityStore,
updateThreadHashesAction,
- () => null,
threadInfos,
[],
).integrityStore,
@@ -134,7 +133,6 @@
reduceIntegrityStore(
oldIntegrityStore,
updateThreadHashesAction,
- () => null,
threadInfos,
threadStoreOperations,
).integrityStore,
@@ -178,7 +176,6 @@
reduceIntegrityStore(
oldIntegrityStore,
updateThreadHashesAction,
- () => null,
threadInfos,
threadStoreOperations,
).integrityStore,
@@ -216,7 +213,6 @@
reduceIntegrityStore(
oldIntegrityStore,
updateThreadHashesAction,
- () => null,
threadInfos,
threadStoreOperations,
).integrityStore,
diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js
--- a/lib/reducers/master-reducer.js
+++ b/lib/reducers/master-reducer.js
@@ -175,7 +175,6 @@
const { integrityStore, integrityStoreOperations } = reduceIntegrityStore(
state.integrityStore,
action,
- onStateDifferenceForStaff,
threadInfos,
threadStoreOperations,
);
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 {

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 4:41 AM (16 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2588228
Default Alt Text
D12686.id42779.diff (3 KB)

Event Timeline