From f886c885580ab5e77b4b95c599d286dffbb61986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noe=CC=81=20Malzieu?= Date: Thu, 27 Jun 2024 17:06:58 +0200 Subject: [PATCH] Fix frames caching display because group is refreshing --- .../PinnedConversations.tsx | 2 +- screens/Conversation.tsx | 26 +------------------ screens/ConversationList.tsx | 5 +++- 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/components/PinnedConversations/PinnedConversations.tsx b/components/PinnedConversations/PinnedConversations.tsx index 640f51ee4..234c858b0 100644 --- a/components/PinnedConversations/PinnedConversations.tsx +++ b/components/PinnedConversations/PinnedConversations.tsx @@ -11,7 +11,7 @@ export default function PinnedConversations({ convos }: Props) { const pinnedConvos = !convos ? [] : convos?.map((convo) => { - return ; + return ; }); return {pinnedConvos}; } diff --git a/screens/Conversation.tsx b/screens/Conversation.tsx index 5ea62e4d8..606a60ae3 100644 --- a/screens/Conversation.tsx +++ b/screens/Conversation.tsx @@ -26,12 +26,7 @@ import { isDesktop } from "../utils/device"; import { converseEventEmitter } from "../utils/events"; import { setTopicToNavigateTo, topicToNavigateTo } from "../utils/navigation"; import { getTitleFontScale, TextInputWithValue } from "../utils/str"; -import { ConverseXmtpClientType } from "../utils/xmtpRN/client"; -import { - loadOlderMessages, - syncGroupsMessages, -} from "../utils/xmtpRN/messages"; -import { getXmtpClient } from "../utils/xmtpRN/sync"; +import { loadOlderMessages } from "../utils/xmtpRN/messages"; import { NavigationParamList } from "./Navigation/Navigation"; const Conversation = ({ @@ -245,24 +240,6 @@ const Conversation = ({ }; }, [navigation, onLeaveScreen, onOpeningConversation]); - const refreshGroup = useCallback(async () => { - if (!conversation?.isGroup || !conversation?.topic) return; - const client = (await getXmtpClient( - currentAccount() - )) as ConverseXmtpClientType; - if (!client) return; - const groups = await client.conversations.listGroups(); - const group = groups.find((g) => g.topic === conversation.topic); - if (!group) return; - syncGroupsMessages(currentAccount(), [group], { - [conversation?.topic]: 0, - }); - }, [conversation?.isGroup, conversation?.topic]); - - useEffect(() => { - refreshGroup(); - }, [refreshGroup]); - return ( {route.params?.topic || route.params?.mainConversationWithPeer ? ( @@ -277,7 +254,6 @@ const Conversation = ({ setTransactionMode, frameTextInputFocused, setFrameTextInputFocused, - onPullToRefresh: conversation?.isGroup ? refreshGroup : undefined, }} > diff --git a/screens/ConversationList.tsx b/screens/ConversationList.tsx index 124f82a5d..94a38c4cf 100644 --- a/screens/ConversationList.tsx +++ b/screens/ConversationList.tsx @@ -154,7 +154,10 @@ function ConversationList({ navigation, route, searchBarRef }: Props) { }, [clearSearch, isSplit, openedConversationTopic]); const ListHeaderComponents: React.ReactElement[] = [ - , + , ]; const showSearchTitleHeader = ((Platform.OS === "ios" && searchBarFocused && !showNoResult) ||