Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3502813
D6461.id22182.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6461.id22182.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6461: [web] Add a selector fetching thread IDs according to COMMUNITIES calendar filter
Attached
Detach File
Event Timeline
Log In to Comment