Page MenuHomePhabricator

D9204.diff
No OneTemporary

D9204.diff

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
@@ -43,6 +43,7 @@
import {
threadTypes,
threadTypeIsCommunityRoot,
+ type ThreadType,
} from '../types/thread-types-enum.js';
import {
type ThreadInfo,
@@ -463,6 +464,31 @@
baseSavedEmojiAvatarSelectorForThread,
);
+const baseThreadInfosSelectorForThreadType = (threadType: ThreadType) =>
+ createSelector(
+ (state: BaseAppState<>) => threadInfoSelector(state),
+ (threadInfos: {
+ +[id: string]: ThreadInfo,
+ }): $ReadOnlyArray<ThreadInfo> => {
+ const result = [];
+
+ for (const threadID in threadInfos) {
+ const threadInfo = threadInfos[threadID];
+ if (threadInfo.type === threadType) {
+ result.push(threadInfo);
+ }
+ }
+
+ return result;
+ },
+ );
+
+const threadInfosSelectorForThreadType: (
+ threadType: ThreadType,
+) => (state: BaseAppState<>) => $ReadOnlyArray<ThreadInfo> = _memoize(
+ baseThreadInfosSelectorForThreadType,
+);
+
export {
ancestorThreadInfos,
threadInfoSelector,
@@ -482,4 +508,5 @@
threadInfoFromSourceMessageIDSelector,
pendingToRealizedThreadIDsSelector,
savedEmojiAvatarSelectorForThread,
+ threadInfosSelectorForThreadType,
};

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 10:28 PM (17 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2565955
Default Alt Text
D9204.diff (1 KB)

Event Timeline