From 1e401210bfdf7902ae0de48a0c28f52f5884cd12 Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Tue, 13 Aug 2024 10:21:06 -0600 Subject: [PATCH] Update pinned conversation as well --- .../PinnedConversation.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/components/PinnedConversations/PinnedConversation.tsx b/components/PinnedConversations/PinnedConversation.tsx index 8b9471fe0..98508c782 100644 --- a/components/PinnedConversations/PinnedConversation.tsx +++ b/components/PinnedConversations/PinnedConversation.tsx @@ -1,3 +1,5 @@ +import { useGroupNameQuery } from "@queries/useGroupNameQuery"; +import { useGroupPhotoQuery } from "@queries/useGroupPhotoQuery"; import { backgroundColor, textSecondaryColor } from "@styles/colors"; import { AvatarSizes } from "@styles/sizes"; import { FC, useCallback } from "react"; @@ -9,10 +11,12 @@ import { } from "react-native"; import Avatar from "..//Avatar"; -import { useChatStore, useProfilesStore } from "../../data/store/accountsStore"; +import { + useChatStore, + useCurrentAccount, + useProfilesStore, +} from "../../data/store/accountsStore"; import { XmtpConversation } from "../../data/store/chatStore"; -import { useGroupName } from "../../hooks/useGroupName"; -import { useGroupPhoto } from "../../hooks/useGroupPhoto"; import { navigate } from "../../utils/navigation"; import { getPreferredAvatar, getPreferredName } from "../../utils/profile"; import GroupAvatar from "../GroupAvatar"; @@ -22,10 +26,15 @@ interface Props { } export const PinnedConversation: FC = ({ conversation }) => { + const account = useCurrentAccount() as string; const profiles = useProfilesStore((s) => s.profiles); const { topic, isGroup } = conversation; - const { groupName } = useGroupName(topic); - const { groupPhoto } = useGroupPhoto(topic); + const { data: groupName } = useGroupNameQuery(account, topic, { + refetchOnMount: false, + }); + const { data: groupPhoto } = useGroupPhotoQuery(account, topic, { + refetchOnMount: false, + }); const title = isGroup ? groupName : conversation.conversationTitle; const socials = profiles[conversation.peerAddress as string]?.socials; const avatar = isGroup ? groupPhoto : getPreferredAvatar(socials);