Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3061255
D8097.id27448.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
D8097.id27448.diff
View Options
diff --git a/native/chat/message-results-screen.react.js b/native/chat/message-results-screen.react.js
--- a/native/chat/message-results-screen.react.js
+++ b/native/chat/message-results-screen.react.js
@@ -68,8 +68,18 @@
return [];
}
+ const pinnedMessageIDs = new Set();
+ translatedMessageResults.forEach(item => pinnedMessageIDs.add(item.id));
+
+ // Some pinned messages not part of the Redux when a chat is loaded will
+ // get excluded since their `isPinned` flag will not be set as true.
+ // Adding the conditional clause to check if the chatMessageInfo's id
+ // is included in the set of pinned messages fetched from the DB will
+ // ensure we don't skip any pinned messages.
const chatMessageInfoItems = chatMessageInfos.filter(
- item => item.itemType === 'message' && item.isPinned,
+ item =>
+ item.itemType === 'message' &&
+ pinnedMessageIDs.has(item.messageInfo.id),
);
// By the nature of using messageListData and passing in
@@ -94,7 +104,7 @@
}
return sortedChatMessageInfoItems.filter(Boolean);
- }, [chatMessageInfos, rawMessageResults]);
+ }, [translatedMessageResults, chatMessageInfos, rawMessageResults]);
const measureCallback = React.useCallback(
(listDataWithHeights: $ReadOnlyArray<ChatMessageItemWithHeight>) => {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 25, 12:23 PM (22 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2363961
Default Alt Text
D8097.id27448.diff (1 KB)
Attached To
Mode
D8097: [native] Display pinned messages not present in Redux
Attached
Detach File
Event Timeline
Log In to Comment