Page MenuHomePhabricator

D11980.id40044.diff
No OneTemporary

D11980.id40044.diff

diff --git a/web/modals/threads/sidebars/sidebars-modal.react.js b/web/modals/threads/sidebars/sidebars-modal.react.js
--- a/web/modals/threads/sidebars/sidebars-modal.react.js
+++ b/web/modals/threads/sidebars/sidebars-modal.react.js
@@ -3,7 +3,11 @@
import * as React from 'react';
import { useFilteredChildThreads } from 'lib/hooks/child-threads.js';
-import { threadInChatList, threadIsSidebar } from 'lib/shared/thread-utils.js';
+import {
+ threadIsSidebar,
+ useThreadsInChatList,
+} from 'lib/shared/thread-utils.js';
+import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
import SidebarList from './sidebar-list.react.js';
import css from './sidebars-modal.css';
@@ -43,17 +47,28 @@
searchText,
});
+ const sidebarThreadInfos: $ReadOnlyArray<ThreadInfo> = React.useMemo(
+ () => sidebarList.map(chatItem => chatItem.threadInfo),
+ [sidebarList],
+ );
+
+ const visibleSidebarThreadInfos = useThreadsInChatList(sidebarThreadInfos);
+ const visibleSidebarThreadIDs = React.useMemo(
+ () => new Set(visibleSidebarThreadInfos.map(thread => thread.id)),
+ [visibleSidebarThreadInfos],
+ );
+
const tabContent = React.useMemo(() => {
if (tab === 'All Threads') {
return <SidebarList sidebars={sidebarList} />;
}
const sidebarsChatListVisibleInChat = sidebarList.filter(chatItem =>
- threadInChatList(chatItem.threadInfo),
+ visibleSidebarThreadIDs.has(chatItem.threadInfo.id),
);
return <SidebarList sidebars={sidebarsChatListVisibleInChat} />;
- }, [sidebarList, tab]);
+ }, [sidebarList, tab, visibleSidebarThreadIDs]);
const sidebarsModalContent = React.useMemo(
() => (

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 2, 6:41 PM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2607989
Default Alt Text
D11980.id40044.diff (1 KB)

Event Timeline