Page MenuHomePhabricator

D5670.id18568.diff
No OneTemporary

D5670.id18568.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
@@ -126,6 +126,13 @@
);
}
+const newThread = () => ({
+ messageIDs: [],
+ startReached: false,
+ lastNavigatedTo: 0,
+ lastPruned: Date.now(),
+});
+
type FreshMessageStoreResult = {
+messageStoreOperations: $ReadOnlyArray<MessageStoreOperation>,
+messageStore: MessageStore,
@@ -154,14 +161,12 @@
const threadsToMessageIDs = mapThreadsToMessageIDsFromOrderedMessageInfos(
orderedMessageInfos,
);
- const lastPruned = Date.now();
const threads = _mapValuesWithKeys(
(messageIDs: string[], threadID: string) => ({
+ ...newThread(),
messageIDs,
startReached:
truncationStatus[threadID] === messageTruncationStatus.EXHAUSTIVE,
- lastNavigatedTo: 0,
- lastPruned,
}),
)(threadsToMessageIDs);
const watchedIDs = threadWatcher.getWatchedIDs();
@@ -173,12 +178,7 @@
) {
continue;
}
- threads[threadID] = {
- messageIDs: [],
- startReached: false,
- lastNavigatedTo: 0,
- lastPruned,
- };
+ threads[threadID] = newThread();
}
return {
messageStoreOperations,
@@ -418,7 +418,6 @@
);
const oldMessageInfosToCombine = [];
const threadsThatNeedMessageIDsResorted = [];
- const lastPruned = Date.now();
const local = {};
const threads = _flow(
_mapValuesWithKeys((messageIDs: string[], threadID: string) => {
@@ -426,10 +425,9 @@
const truncate = truncationStatus[threadID];
if (!oldThread) {
return {
+ ...newThread(),
messageIDs,
startReached: truncate === messageTruncationStatus.EXHAUSTIVE,
- lastNavigatedTo: 0,
- lastPruned,
};
}
let oldMessageIDsUnchanged = true;
@@ -611,12 +609,7 @@
isThreadWatched(threadID, threadInfo, watchedIDs) &&
!filteredThreads[threadID]
) {
- filteredThreads[threadID] = {
- messageIDs: [],
- startReached: false,
- lastNavigatedTo: 0,
- lastPruned: Date.now(),
- };
+ filteredThreads[threadID] = newThread();
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 11:27 AM (20 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2686619
Default Alt Text
D5670.id18568.diff (2 KB)

Event Timeline