Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3156024
D11980.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
D11980.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D11980: [web] Replace `threadInChatList` with `useThreadsInChatList` in `SidebarsModal`
Attached
Detach File
Event Timeline
Log In to Comment