diff --git a/src/state/cache/profile-shadow.ts b/src/state/cache/profile-shadow.ts index 85e5b73396..8b61b4416e 100644 --- a/src/state/cache/profile-shadow.ts +++ b/src/state/cache/profile-shadow.ts @@ -10,6 +10,7 @@ import {findAllProfilesInQueryData as findAllProfilesInExploreFeedPreviewsQueryD import {findAllProfilesInQueryData as findAllProfilesInContactMatchesQueryData} from '#/state/queries/find-contacts' import {findAllProfilesInQueryData as findAllProfilesInKnownFollowersQueryData} from '#/state/queries/known-followers' import {findAllProfilesInQueryData as findAllProfilesInListMembersQueryData} from '#/state/queries/list-members' +import {findAllProfilesInQueryData as findAllProfilesInGetConvoQueryData} from '#/state/queries/messages/conversation' import {findAllProfilesInQueryData as findAllProfilesInListConvosQueryData} from '#/state/queries/messages/list-conversations' import {findAllProfilesInQueryData as findAllProfilesInMessagesQueryData} from '#/state/queries/messages/list-convo-members' import {findAllProfilesInQueryData as findAllProfilesInMyBlockedAccountsQueryData} from '#/state/queries/my-blocked-accounts' @@ -266,4 +267,5 @@ function* findProfilesInCache( yield* findAllProfilesInNotifsQueryData(queryClient, did) yield* findAllProfilesInContactMatchesQueryData(queryClient, did) yield* findAllProfilesInMessagesQueryData(queryClient, did) + yield* findAllProfilesInGetConvoQueryData(queryClient, did) } diff --git a/src/state/queries/messages/conversation.ts b/src/state/queries/messages/conversation.ts index 76557991d1..2ce6c06e51 100644 --- a/src/state/queries/messages/conversation.ts +++ b/src/state/queries/messages/conversation.ts @@ -1,4 +1,8 @@ -import {type ChatBskyConvoDefs} from '@atproto/api' +import { + type ChatBskyActorDefs, + type ChatBskyConvoDefs, + type ChatBskyConvoGetConvo, +} from '@atproto/api' import { type QueryClient, useMutation, @@ -109,3 +113,22 @@ export function useMarkAsReadMutation() { }, }) } + +export function* findAllProfilesInQueryData( + queryClient: QueryClient, + did: string, +): Generator { + const queryDatas = queryClient.getQueriesData< + ChatBskyConvoGetConvo.OutputSchema['convo'] + >({ + queryKey: [RQKEY_ROOT], + }) + for (const [_queryKey, queryData] of queryDatas) { + if (!queryData) continue + for (const member of queryData.members) { + if (member.did === did) { + yield member + } + } + } +}