Page MenuHomePhabricator

D6603.id22016.diff
No OneTemporary

D6603.id22016.diff

diff --git a/native/navigation/community-drawer-content.react.js b/native/navigation/community-drawer-content.react.js
--- a/native/navigation/community-drawer-content.react.js
+++ b/native/navigation/community-drawer-content.react.js
@@ -10,7 +10,12 @@
communityThreadSelector,
} from 'lib/selectors/thread-selectors';
import { threadIsChannel } from 'lib/shared/thread-utils';
-import { type ThreadInfo, communitySubthreads } from 'lib/types/thread-types';
+import {
+ type ThreadInfo,
+ type ResolvedThreadInfo,
+ communitySubthreads,
+} from 'lib/types/thread-types';
+import { useResolvedThreadInfos } from 'lib/utils/entity-helpers';
import { useNavigateToThread } from '../chat/message-list-types';
import { useStyles } from '../themes/colors';
@@ -25,9 +30,11 @@
function CommunityDrawerContent(): React.Node {
const communities = useSelector(communityThreadSelector);
- const communitiesSuffixed = React.useMemo(() => appendSuffix(communities), [
- communities,
- ]);
+ const resolvedCommunities = useResolvedThreadInfos(communities);
+ const communitiesSuffixed = React.useMemo(
+ () => appendSuffix(resolvedCommunities),
+ [resolvedCommunities],
+ );
const styles = useStyles(unboundStyles);
const [openCommunity, setOpenCommunity] = React.useState(
@@ -91,7 +98,7 @@
function createRecursiveDrawerItemsData(
childThreadInfosMap: { +[id: string]: $ReadOnlyArray<ThreadInfo> },
- communities: $ReadOnlyArray<ThreadInfo>,
+ communities: $ReadOnlyArray<ResolvedThreadInfo>,
labelStyles: $ReadOnlyArray<TextStyle>,
) {
const result = communities.map(community => ({
@@ -138,7 +145,9 @@
);
}
-function appendSuffix(chats: $ReadOnlyArray<ThreadInfo>): ThreadInfo[] {
+function appendSuffix(
+ chats: $ReadOnlyArray<ResolvedThreadInfo>,
+): ResolvedThreadInfo[] {
const result = [];
const names = new Map<string, number>();
diff --git a/native/navigation/community-drawer-item.react.js b/native/navigation/community-drawer-item.react.js
--- a/native/navigation/community-drawer-item.react.js
+++ b/native/navigation/community-drawer-item.react.js
@@ -4,6 +4,7 @@
import { View, FlatList, TouchableOpacity } from 'react-native';
import type { ThreadInfo } from 'lib/types/thread-types';
+import { useResolvedThreadInfo } from 'lib/utils/entity-helpers';
import type { MessageListParams } from '../chat/message-list-types';
import { SingleLine } from '../components/single-line.react';
@@ -83,6 +84,7 @@
navigateToThread({ threadInfo });
}, [navigateToThread, threadInfo]);
+ const { uiName } = useResolvedThreadInfo(threadInfo);
return (
<View>
<View style={styles.threadEntry}>
@@ -92,7 +94,7 @@
style={styles.textTouchableWrapper}
onLongPress={onExpandToggled}
>
- <SingleLine style={labelStyle}>{threadInfo.uiName}</SingleLine>
+ <SingleLine style={labelStyle}>{uiName}</SingleLine>
</TouchableOpacity>
</View>
{children}

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 4:17 AM (18 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2685808
Default Alt Text
D6603.id22016.diff (2 KB)

Event Timeline