Page MenuHomePhabricator

D6646.id22185.diff
No OneTemporary

D6646.id22185.diff

diff --git a/web/sidebar/community-drawer-item-handlers.react.js b/web/sidebar/community-drawer-item-handlers.react.js
--- a/web/sidebar/community-drawer-item-handlers.react.js
+++ b/web/sidebar/community-drawer-item-handlers.react.js
@@ -3,12 +3,10 @@
import * as React from 'react';
import { useDispatch } from 'react-redux';
-import {
- updateCalendarThreadFilter,
- calendarThreadFilterTypes,
-} from 'lib/types/filter-types';
import type { ThreadInfo } from 'lib/types/thread-types';
+import { updateCalendarCommunityFilter } from '../redux/action-types';
+import { useFilterThreadInfos } from '../selectors/calendar-selectors';
import {
useOnClickThread,
useThreadIsActive,
@@ -40,18 +38,27 @@
function CalendarDrawerItemHandler(props: HandlerProps): React.Node {
const { setHandler, threadInfo } = props;
const dispatch = useDispatch();
-
- const onClick = React.useCallback(
+ const filterThreadInfos = useFilterThreadInfos();
+ const threadIDs = React.useMemo(
() =>
- dispatch({
- type: updateCalendarThreadFilter,
- payload: {
- type: calendarThreadFilterTypes.THREAD_LIST,
- threadIDs: [threadInfo.id],
- },
- }),
- [dispatch, threadInfo.id],
+ filterThreadInfos
+ .filter(
+ thread =>
+ thread.threadInfo.community === threadInfo.id ||
+ thread.threadInfo.id === threadInfo.id,
+ )
+ .map(item => item.threadInfo.id),
+ [filterThreadInfos, threadInfo.id],
);
+
+ const onClick = React.useCallback(() => {
+ dispatch({
+ type: updateCalendarCommunityFilter,
+ payload: {
+ threadIDs,
+ },
+ });
+ }, [dispatch, threadIDs]);
const isActive = false;
const handler = React.useMemo(() => ({ onClick, isActive }), [

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 6:34 AM (18 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2686634
Default Alt Text
D6646.id22185.diff (1 KB)

Event Timeline