Page MenuHomePhabricator

D6461.id22182.diff
No OneTemporary

D6461.id22182.diff

diff --git a/web/selectors/thread-selectors.js b/web/selectors/thread-selectors.js
--- a/web/selectors/thread-selectors.js
+++ b/web/selectors/thread-selectors.js
@@ -3,6 +3,7 @@
import invariant from 'invariant';
import * as React from 'react';
import { useDispatch } from 'react-redux';
+import { createSelector } from 'reselect';
import { ENSCacheContext } from 'lib/components/ens-cache-provider.react';
import { createPendingSidebar } from 'lib/shared/thread-utils';
@@ -14,6 +15,7 @@
import { getDefaultTextMessageRules } from '../markdown/rules.react';
import { updateNavInfoActionType } from '../redux/action-types';
+import type { AppState, CalendarCommunityFilter } from '../redux/redux-setup';
import { useSelector } from '../redux/redux-utils';
function useOnClickThread(
@@ -107,9 +109,22 @@
);
}
+const filteredCommunityThreadIDsSelector: (
+ state: AppState,
+) => ?$ReadOnlySet<string> = createSelector(
+ (state: AppState) => state.communityFilter,
+ (communityFilter: ?CalendarCommunityFilter): ?Set<string> => {
+ if (!communityFilter || communityFilter.threadIDs.length === 0) {
+ return null;
+ }
+ return new Set(communityFilter.threadIDs);
+ },
+);
+
export {
useOnClickThread,
useThreadIsActive,
useOnClickPendingSidebar,
useOnClickNewThread,
+ filteredCommunityThreadIDsSelector,
};

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 5:08 AM (18 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2686017
Default Alt Text
D6461.id22182.diff (1 KB)

Event Timeline