diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js --- a/lib/selectors/thread-selectors.js +++ b/lib/selectors/thread-selectors.js @@ -200,6 +200,27 @@ }, ); +const containedThreadInfos: (state: BaseAppState<*>) => { + +[id: string]: $ReadOnlyArray, +} = createSelector( + threadInfoSelector, + (threadInfos: { +[id: string]: ThreadInfo }) => { + const result = {}; + for (const id in threadInfos) { + const threadInfo = threadInfos[id]; + const containingThreadID = threadInfo.containingThreadID; + if (containingThreadID === null || containingThreadID === undefined) { + continue; + } + if (result[containingThreadID] === undefined) { + result[containingThreadID] = []; + } + result[containingThreadID].push(threadInfo); + } + return result; + }, +); + function getMostRecentRawMessageInfo( threadInfo: ThreadInfo, messageStore: MessageStore, @@ -453,6 +474,7 @@ entryInfoSelector, currentDaysToEntries, childThreadInfos, + containedThreadInfos, unreadCount, unreadBackgroundCount, otherUsersButNoOtherAdmins,