Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33195055
D9102.1768540392.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D9102.1768540392.diff
View Options
diff --git a/native/chat/chat-thread-list-item.react.js b/native/chat/chat-thread-list-item.react.js
--- a/native/chat/chat-thread-list-item.react.js
+++ b/native/chat/chat-thread-list-item.react.js
@@ -61,32 +61,45 @@
data.sidebars.filter(sidebarItem => sidebarItem.type === 'sidebar').length -
1;
- const sidebars = data.sidebars.map((sidebarItem, index) => {
- if (sidebarItem.type === 'sidebar') {
- const { type, ...sidebarInfo } = sidebarItem;
- return (
- <ChatThreadListSidebar
- sidebarInfo={sidebarInfo}
- onPressItem={onPressItem}
- onSwipeableWillOpen={onSwipeableWillOpen}
- currentlyOpenedSwipeableId={currentlyOpenedSwipeableId}
- key={sidebarItem.threadInfo.id}
- extendArrow={index < numOfSidebarsWithExtendedArrow}
- />
- );
- } else if (sidebarItem.type === 'seeMore') {
- return (
- <ChatThreadListSeeMoreSidebars
- threadInfo={data.threadInfo}
- unread={sidebarItem.unread}
- onPress={onPressSeeMoreSidebars}
- key="seeMore"
- />
- );
- } else {
- return <View style={styles.spacer} key="spacer" />;
- }
- });
+ const sidebars = React.useMemo(
+ () =>
+ data.sidebars.map((sidebarItem, index) => {
+ if (sidebarItem.type === 'sidebar') {
+ const { type, ...sidebarInfo } = sidebarItem;
+ return (
+ <ChatThreadListSidebar
+ sidebarInfo={sidebarInfo}
+ onPressItem={onPressItem}
+ onSwipeableWillOpen={onSwipeableWillOpen}
+ currentlyOpenedSwipeableId={currentlyOpenedSwipeableId}
+ key={sidebarItem.threadInfo.id}
+ extendArrow={index < numOfSidebarsWithExtendedArrow}
+ />
+ );
+ } else if (sidebarItem.type === 'seeMore') {
+ return (
+ <ChatThreadListSeeMoreSidebars
+ threadInfo={data.threadInfo}
+ unread={sidebarItem.unread}
+ onPress={onPressSeeMoreSidebars}
+ key="seeMore"
+ />
+ );
+ } else {
+ return <View style={styles.spacer} key="spacer" />;
+ }
+ }),
+ [
+ currentlyOpenedSwipeableId,
+ data.sidebars,
+ data.threadInfo,
+ numOfSidebarsWithExtendedArrow,
+ onPressItem,
+ onPressSeeMoreSidebars,
+ onSwipeableWillOpen,
+ styles.spacer,
+ ],
+ );
const onPress = React.useCallback(() => {
onPressItem(data.threadInfo, data.pendingPersonalThreadUserInfo);
diff --git a/native/chat/chat-thread-list-sidebar.react.js b/native/chat/chat-thread-list-sidebar.react.js
--- a/native/chat/chat-thread-list-sidebar.react.js
+++ b/native/chat/chat-thread-list-sidebar.react.js
@@ -66,6 +66,11 @@
],
);
+ const sidebarItem = React.useMemo(
+ () => <SidebarItem sidebarInfo={sidebarInfo} />,
+ [sidebarInfo],
+ );
+
const swipeableThread = React.useMemo(
() => (
<View style={styles.swipeableThreadContainer}>
@@ -76,14 +81,16 @@
currentlyOpenedSwipeableId={currentlyOpenedSwipeableId}
iconSize={16}
>
- <SidebarItem sidebarInfo={sidebarInfo} />
+ {sidebarItem}
</SwipeableThread>
</View>
),
[
currentlyOpenedSwipeableId,
onSwipeableWillOpen,
- sidebarInfo,
+ sidebarInfo.mostRecentNonLocalMessage,
+ sidebarInfo.threadInfo,
+ sidebarItem,
styles.swipeableThreadContainer,
],
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 16, 5:13 AM (1 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5942052
Default Alt Text
D9102.1768540392.diff (3 KB)
Attached To
Mode
D9102: [native] Memoize construction of `sidebars` in `ChatThreadListItem`
Attached
Detach File
Event Timeline
Log In to Comment