Page MenuHomePhabricator

D4333.id13751.diff
No OneTemporary

D4333.id13751.diff

diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js
--- a/lib/reducers/message-reducer.js
+++ b/lib/reducers/message-reducer.js
@@ -92,11 +92,8 @@
processUpdatesActionType,
} from '../types/update-types';
import { setNewSessionActionType } from '../utils/action-utils';
-import { isDev } from '../utils/dev-utils';
import { translateClientDBMessageInfosToRawMessageInfos } from '../utils/message-ops-utils';
-import { assertObjectsAreEqual } from '../utils/objects';
-const PROCESSED_MSG_STORE_INVARIANTS_DISABLED = !isDev;
const _mapValuesWithKeys = _mapValues.convert({ cap: false });
// Input must already be ordered!
@@ -128,22 +125,6 @@
);
}
-function assertMessageStoreMessagesAreEqual(
- processedMessageStore: MessageStore,
- expectedMessageStore: MessageStore,
- location: string,
-) {
- if (PROCESSED_MSG_STORE_INVARIANTS_DISABLED) {
- return;
- }
-
- assertObjectsAreEqual(
- processedMessageStore.messages,
- expectedMessageStore.messages,
- `MessageStore.messages - ${location}`,
- );
-}
-
type FreshMessageStoreResult = {
+messageStoreOperations: $ReadOnlyArray<MessageStoreOperation>,
+messageStore: MessageStore,
@@ -282,11 +263,10 @@
newMessageInfos: $ReadOnlyArray<RawMessageInfo>,
truncationStatus: { [threadID: string]: MessageTruncationStatus },
threadInfos: { +[threadID: string]: RawThreadInfo },
- actionType: *,
): MergeNewMessagesResult {
const {
messageStoreOperations: updateWithLatestThreadInfosOps,
- messageStore: updatedMessageStore,
+ messageStore: messageStoreUpdatedWithLatestThreadInfos,
reassignedThreadIDs,
} = updateMessageStoreWithLatestThreadInfos(oldMessageStore, threadInfos);
@@ -294,11 +274,11 @@
oldMessageStore,
updateWithLatestThreadInfosOps,
);
- assertMessageStoreMessagesAreEqual(
- messageStoreAfterUpdateOps,
- updatedMessageStore,
- `${actionType}| reassignment and filtering`,
- );
+
+ const updatedMessageStore = {
+ ...messageStoreUpdatedWithLatestThreadInfos,
+ messages: messageStoreAfterUpdateOps.messages,
+ };
const localIDsToServerIDs: Map<string, string> = new Map();
@@ -754,7 +734,6 @@
messagesResult.rawMessageInfos,
messagesResult.truncationStatuses,
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
} else if (action.type === processUpdatesActionType) {
@@ -775,7 +754,6 @@
messagesResult.rawMessageInfos,
messagesResult.truncationStatuses,
newThreadInfos,
- action.type,
);
return {
messageStoreOperations,
@@ -799,7 +777,6 @@
messagesResult.rawMessageInfos,
messagesResult.truncationStatuses,
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
} else if (
@@ -813,7 +790,6 @@
action.payload.rawMessageInfos,
action.payload.truncationStatuses,
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
} else if (
@@ -828,7 +804,6 @@
action.payload.rawMessageInfos,
{ [action.payload.threadID]: action.payload.truncationStatus },
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
} else if (
@@ -868,7 +843,6 @@
messagesResult.rawMessageInfos,
messagesResult.truncationStatuses,
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
} else if (action.type === registerActionTypes.success) {
@@ -885,7 +859,6 @@
action.payload.rawMessageInfos,
truncationStatuses,
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
} else if (
@@ -901,7 +874,6 @@
action.payload.newMessageInfos,
{ [action.payload.threadID]: messageTruncationStatus.UNCHANGED },
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
} else if (
@@ -916,7 +888,6 @@
action.payload.newMessageInfos,
{ [action.payload.threadID]: messageTruncationStatus.UNCHANGED },
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
} else if (action.type === deleteEntryActionTypes.success) {
@@ -930,7 +901,6 @@
payload.newMessageInfos,
{ [payload.threadID]: messageTruncationStatus.UNCHANGED },
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
}
@@ -944,7 +914,6 @@
action.payload.newMessageInfos,
{ [threadID]: messageTruncationStatus.UNCHANGED },
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
} else if (action.type === joinThreadActionTypes.success) {
@@ -960,7 +929,6 @@
messagesResult.rawMessageInfos,
messagesResult.truncationStatuses,
newThreadInfos,
- action.type,
);
return { messageStoreOperations, messageStore: mergedMessageStore };
} else if (
@@ -1158,7 +1126,6 @@
action.payload.rawMessageInfos,
truncationStatuses,
newThreadInfos,
- action.type,
);
return {
messageStoreOperations,

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 9:19 PM (1 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678287
Default Alt Text
D4333.id13751.diff (5 KB)

Event Timeline