diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js --- a/lib/reducers/thread-reducer.js +++ b/lib/reducers/thread-reducer.js @@ -58,11 +58,7 @@ +updatesResult: { +newUpdates: $ReadOnlyArray, ... }, ... }, -): { - +threadStoreOperations: $ReadOnlyArray, - +threadInfos: { +[id: string]: RawThreadInfo }, -} { - const updatedThreadInfos = { ...threadInfos }; +): $ReadOnlyArray { let someThreadUpdated = false; const threadOperations: ThreadStoreOperation[] = []; for (const update of payload.updatesResult.newUpdates) { @@ -72,7 +68,6 @@ !_isEqual(threadInfos[update.threadInfo.id])(update.threadInfo) ) { someThreadUpdated = true; - updatedThreadInfos[update.threadInfo.id] = update.threadInfo; threadOperations.push({ type: 'replace', payload: { @@ -93,7 +88,6 @@ unread: update.unread, }, }; - updatedThreadInfos[update.threadID] = updatedThread; threadOperations.push({ type: 'replace', payload: { @@ -106,7 +100,6 @@ threadInfos[update.threadID] ) { someThreadUpdated = true; - delete updatedThreadInfos[update.threadID]; threadOperations.push({ type: 'remove', payload: { @@ -125,7 +118,6 @@ ...threadInfo, members: newMembers, }; - updatedThreadInfos[threadID] = updatedThread; threadOperations.push({ type: 'replace', payload: { @@ -138,12 +130,9 @@ } } if (!someThreadUpdated) { - return { threadStoreOperations: [], threadInfos }; + return []; } - return { - threadStoreOperations: threadOperations, - threadInfos: updatedThreadInfos, - }; + return threadOperations; } const emptyArray = []; @@ -245,7 +234,7 @@ threadStoreOperations: [], }; } - const { threadStoreOperations } = reduceThreadUpdates( + const threadStoreOperations = reduceThreadUpdates( state.threadInfos, action.payload, );