Page MenuHomePhabricator

D11980.diff
No OneTemporary

D11980.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
Wed, Nov 6, 1:03 PM (20 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2430983
Default Alt Text
D11980.diff (1 KB)

Event Timeline