Page MenuHomePhabricator

D9449.id31939.diff
No OneTemporary

D9449.id31939.diff

diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -1768,30 +1768,12 @@
return chatMentionCandidatesObj;
}
+const emptyMentionCandidates = {};
function useThreadChatMentionCandidates(
+ // eslint-disable-next-line no-unused-vars
threadInfo: ThreadInfo,
): ChatMentionCandidates {
- const { chatMentionCandidatesObj, communityThreadIDForGenesisThreads } =
- useChatMentionCandidatesObjAndUtils();
- return React.useMemo(() => {
- let communityID,
- result = {};
- if (threadInfo.community === genesis.id) {
- communityID = communityThreadIDForGenesisThreads[threadInfo.id];
- } else {
- communityID = threadInfo.community ?? threadInfo.id;
- }
- if (chatMentionCandidatesObj[communityID]) {
- result = { ...chatMentionCandidatesObj[communityID] };
- }
- delete result[threadInfo.id];
- return result;
- }, [
- chatMentionCandidatesObj,
- communityThreadIDForGenesisThreads,
- threadInfo.community,
- threadInfo.id,
- ]);
+ return emptyMentionCandidates;
}
function useUserProfileThreadInfo(userInfo: ?UserInfo): ?UserProfileThreadInfo {
@@ -1852,6 +1834,7 @@
]);
}
+// eslint-disable-next-line no-unused-vars
function useChatMentionSearchIndex(): {
+[id: string]: SentencePrefixSearchIndex,
} {
@@ -1880,20 +1863,12 @@
}, [chatMentionCandidatesObj]);
}
+const emptySearchIndex = new SentencePrefixSearchIndex();
function useThreadChatMentionSearchIndex(
+ // eslint-disable-next-line no-unused-vars
threadInfo: ThreadInfo,
): SentencePrefixSearchIndex {
- const chatMentionCandidatesSearchIndex = useChatMentionSearchIndex();
- const { communityThreadIDForGenesisThreads } =
- useChatMentionCandidatesObjAndUtils();
- if (threadInfo.community === genesis.id) {
- return chatMentionCandidatesSearchIndex[
- communityThreadIDForGenesisThreads[threadInfo.id]
- ];
- }
- return chatMentionCandidatesSearchIndex[
- threadInfo.community ?? threadInfo.id
- ];
+ return emptySearchIndex;
}
export {

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 2, 5:48 PM (19 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2608464
Default Alt Text
D9449.id31939.diff (2 KB)

Event Timeline