Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3529668
D10029.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
D10029.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
@@ -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
Details
Attached
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)
Attached To
Mode
D10029: [Flow202][native][skip-ci] [45/x] Add types for uniqueChatMessageInfoItemsMap
Attached
Detach File
Event Timeline
Log In to Comment