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 @@ -1128,24 +1128,40 @@ const newMessageIDs = messageStore.threads[threadID].messageIDs.filter( id => id !== localID, ); + const updatedThreads = { + [threadID]: { + ...messageStore.threads[threadID], + messageIDs: newMessageIDs, + }, + }; + + messageStoreOperations.push({ + type: 'replace_threads', + payload: { threads: updatedThreads }, + }); const processedMessageStore = processMessageStoreOperations( messageStore, messageStoreOperations, ); + const newMessageStore = { + ...processedMessageStore, + threads: { + ...messageStore.threads, + ...updatedThreads, + }, + }; + + assertMessageStoreThreadsAreEqual( + processedMessageStore, + newMessageStore, + action.type, + ); + return { messageStoreOperations, - messageStore: { - ...processedMessageStore, - threads: { - ...messageStore.threads, - [threadID]: { - ...messageStore.threads[threadID], - messageIDs: newMessageIDs, - }, - }, - }, + messageStore: newMessageStore, }; } else if ( action.type === sendTextMessageActionTypes.success ||