Page MenuHomePhabricator

D10029.diff
No OneTemporary

D10029.diff

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
@@ -6,7 +6,10 @@
import { ScrollView } from 'react-native-gesture-handler';
import { useFetchPinnedMessages } from 'lib/actions/message-actions.js';
-import { messageListData } from 'lib/selectors/chat-selectors.js';
+import {
+ messageListData,
+ type ChatMessageInfoItem,
+} from 'lib/selectors/chat-selectors.js';
import {
createMessageInfo,
isInvalidPinSourceForThread,
@@ -92,7 +95,10 @@
// By the nature of using messageListData and passing in
// the desired translatedMessageResults as additional
// messages, we will have duplicate ChatMessageInfoItems.
- const uniqueChatMessageInfoItemsMap = new Map();
+ const uniqueChatMessageInfoItemsMap = new Map<
+ string,
+ ChatMessageInfoItem,
+ >();
chatMessageInfoItems.forEach(
item =>
item.messageInfo &&
@@ -105,9 +111,9 @@
// in the order of pin_time (newest first).
const sortedChatMessageInfoItems = [];
for (let i = 0; i < rawMessageResults.length; i++) {
- sortedChatMessageInfoItems.push(
- uniqueChatMessageInfoItemsMap.get(rawMessageResults[i].id),
- );
+ const { id } = rawMessageResults[i];
+ invariant(id, 'pinned message returned from server should have ID');
+ sortedChatMessageInfoItems.push(uniqueChatMessageInfoItemsMap.get(id));
}
return sortedChatMessageInfoItems.filter(Boolean);

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 8:42 PM (12 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2703122
Default Alt Text
D10029.diff (1 KB)

Event Timeline