Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3266389
D4331.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D4331.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 2:02 AM (20 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2510437
Default Alt Text
D4331.diff (3 KB)
Attached To
Mode
D4331: [lib] Update `messageStore.messages` with `msgStoreOps` for remaining action types
Attached
Detach File
Event Timeline
Log In to Comment