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 @@ -1289,6 +1289,7 @@ const threadInfos = useSelector(state => state.threadStore.threadInfos); const { addLog } = useDebugLogs(); const currentUserSupportsDCs = useCurrentUserSupportsDCs(); + const farcasterDCsLoaded = useFarcasterDCsLoaded(); return React.useCallback( async (farcasterMessage: FarcasterMessage) => { @@ -1306,8 +1307,19 @@ farcasterMessage.conversationId, ) ) { - await fetchConversation(farcasterMessage, true); - return; + if (farcasterDCsLoaded) { + // If DCs have already been synced, then this missing conversation is + // unexpected, and we should fetch all messages for it. No need to + // proceed afterwards since this message will be fetched below + await fetchConversation(farcasterMessage, true); + return; + } else { + // If DCs aren't fully synced yet, there's a possibility that this + // message will be skipped if we don't process it now. We fetch the + // conversation so the reducers don't immediately filter the message + // out, and then we proceed to process this particular message + await fetchConversation(farcasterMessage, false); + } } const userFIDs = extractFarcasterIDsFromPayload( @@ -1376,6 +1388,7 @@ threadInfos, viewerID, currentUserSupportsDCs, + farcasterDCsLoaded, ], ); } @@ -1548,6 +1561,7 @@ const fetchConversationWithBatching = useFetchConversationWithBatching(); const { addLog } = useDebugLogs(); const currentUserSupportsDCs = useCurrentUserSupportsDCs(); + const farcasterDCsLoaded = useFarcasterDCsLoaded(); return React.useCallback( async ( @@ -1591,7 +1605,7 @@ } } - if (unknownConversationIds.length > 0) { + if (farcasterDCsLoaded && unknownConversationIds.length > 0) { await processInBatchesWithReduxBatching( unknownConversationIds, FARCASTER_DATA_BATCH_SIZE, @@ -1627,6 +1641,7 @@ }, [ currentUserSupportsDCs, + farcasterDCsLoaded, addLog, dispatch, fetchConversationWithBatching,