Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32197329
D15329.1765103183.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D15329.1765103183.diff
View Options
diff --git a/lib/shared/farcaster/farcaster-hooks.js b/lib/shared/farcaster/farcaster-hooks.js
--- a/lib/shared/farcaster/farcaster-hooks.js
+++ b/lib/shared/farcaster/farcaster-hooks.js
@@ -638,9 +638,39 @@
state => state.currentUserInfo && state.currentUserInfo.id,
);
const fetchMessage = useGetLatestMessageEdit();
+ const threadInfos = useSelector(state => state.threadStore.threadInfos);
+ const fetchConversationWithMessages = useFetchConversationWithMessages();
+ const currentlyFetchedConversations = React.useRef<Set<string>>(new Set());
return React.useCallback(
async (farcasterMessage: FarcasterMessage) => {
+ if (
+ !threadInfos[
+ farcasterThreadIDFromConversationID(farcasterMessage.conversationId)
+ ] &&
+ !currentlyFetchedConversations.current.has(
+ farcasterMessage.conversationId,
+ )
+ ) {
+ currentlyFetchedConversations.current.add(
+ farcasterMessage.conversationId,
+ );
+ const updates = new BatchedUpdates();
+ await fetchConversationWithMessages(
+ farcasterMessage.conversationId,
+ Number.POSITIVE_INFINITY,
+ updates,
+ );
+ dispatch({
+ type: processFarcasterOpsActionType,
+ payload: updates.getReduxPayload(),
+ });
+ currentlyFetchedConversations.current.delete(
+ farcasterMessage.conversationId,
+ );
+ return;
+ }
+
const userFIDs = extractFarcasterIDsFromPayload(
farcasterMessageValidator,
farcasterMessage,
@@ -672,7 +702,14 @@
payload: { rawMessageInfos, updateInfos: updates, userIDs },
});
},
- [dispatch, fetchMessage, fetchUsersByFIDs, viewerID],
+ [
+ dispatch,
+ fetchConversationWithMessages,
+ fetchMessage,
+ fetchUsersByFIDs,
+ threadInfos,
+ viewerID,
+ ],
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 10:26 AM (17 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5843515
Default Alt Text
D15329.1765103183.diff (1 KB)
Attached To
Mode
D15329: [lib] Fetch all the messages when we receive a message from an unknown conversation
Attached
Detach File
Event Timeline
Log In to Comment