Page MenuHomePhabricator

D4331.id13686.diff
No OneTemporary

D4331.id13686.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
@@ -1126,31 +1126,27 @@
const local = _pickBy(
(localInfo: LocalMessageInfo, key: string) => key !== payload.localID,
)(messageStore.local);
- const updatedMessageStore = {
- messages: newMessages,
- threads: {
- ...messageStore.threads,
- [threadID]: {
- ...messageStore.threads[threadID],
- messageIDs: newMessageIDs,
- },
- },
- local,
- currentAsOf,
- };
const processedMessageStore = processMessageStoreOperations(
messageStore,
messageStoreOperations,
);
- assertMessageStoreMessagesAreEqual(
- processedMessageStore,
- updatedMessageStore,
- action.type,
- );
-
- return { messageStoreOperations, messageStore: updatedMessageStore };
+ return {
+ messageStoreOperations,
+ messageStore: {
+ messages: processedMessageStore.messages,
+ threads: {
+ ...messageStore.threads,
+ [threadID]: {
+ ...messageStore.threads[threadID],
+ messageIDs: newMessageIDs,
+ },
+ },
+ local,
+ currentAsOf,
+ },
+ };
} else if (action.type === saveMessagesActionType) {
const truncationStatuses = {};
for (const messageInfo of action.payload.rawMessageInfos) {
@@ -1206,32 +1202,26 @@
newThreads[threadID] = thread;
}
- const prunedMessageStore = {
- messages: _omit(messageIDsToPrune)(messageStore.messages),
- threads: newThreads,
- local: _omit(messageIDsToPrune)(messageStore.local),
- currentAsOf: messageStore.currentAsOf,
- };
-
const messageStoreOperations = [
{
type: 'remove',
payload: { ids: messageIDsToPrune },
},
];
-
const processedMessageStore = processMessageStoreOperations(
messageStore,
messageStoreOperations,
);
- assertMessageStoreMessagesAreEqual(
- processedMessageStore,
- prunedMessageStore,
- action.type,
- );
-
- return { messageStoreOperations, messageStore: prunedMessageStore };
+ return {
+ messageStoreOperations,
+ messageStore: {
+ messages: processedMessageStore.messages,
+ threads: newThreads,
+ local: _omit(messageIDsToPrune)(messageStore.local),
+ currentAsOf: messageStore.currentAsOf,
+ },
+ };
} else if (action.type === updateMultimediaMessageMediaActionType) {
const { messageID: id, currentMediaID, mediaUpdate } = action.payload;
const message = messageStore.messages[id];
@@ -1409,12 +1399,6 @@
if (newThreads === threads) {
return { messageStoreOperations: [], messageStore };
}
- const newMessageStore = {
- ...messageStore,
- messages: newMessages,
- threads: newThreads,
- local: newLocal,
- };
const messageStoreOperations: MessageStoreOperation[] = [
{
@@ -1427,13 +1411,15 @@
messageStoreOperations,
);
- assertMessageStoreMessagesAreEqual(
- processedMessageStore,
- newMessageStore,
- action.type,
- );
-
- return { messageStoreOperations, messageStore: newMessageStore };
+ return {
+ messageStoreOperations,
+ messageStore: {
+ ...messageStore,
+ messages: processedMessageStore.messages,
+ threads: newThreads,
+ local: newLocal,
+ },
+ };
} else if (action.type === processServerRequestsActionType) {
const {
messageStoreOperations,

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 3:27 AM (21 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2510437
Default Alt Text
D4331.id13686.diff (3 KB)

Event Timeline