diff options
Diffstat (limited to 'src/state/queries/profile.ts')
-rw-r--r-- | src/state/queries/profile.ts | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index 6c801426e..103d34733 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -4,9 +4,6 @@ import { AppBskyActorDefs, AppBskyActorGetProfile, AppBskyActorProfile, - AppBskyEmbedRecord, - AppBskyEmbedRecordWithMedia, - AppBskyFeedDefs, AtUri, BskyAgent, } from '@atproto/api' @@ -29,7 +26,6 @@ import {updateProfileShadow} from '../cache/profile-shadow' import {useAgent, useSession} from '../session' import {RQKEY as RQKEY_MY_BLOCKED} from './my-blocked-accounts' import {RQKEY as RQKEY_MY_MUTED} from './my-muted-accounts' -import {ThreadNode} from './post-thread' const RQKEY_ROOT = 'profile' export const RQKEY = (did: string) => [RQKEY_ROOT, did] @@ -477,56 +473,6 @@ export function precacheProfile( queryClient.setQueryData(profileBasicQueryKey(profile.did), profile) } -export function precacheFeedPostProfiles( - queryClient: QueryClient, - posts: AppBskyFeedDefs.FeedViewPost[], -) { - for (const post of posts) { - // Save the author of the post every time - precacheProfile(queryClient, post.post.author) - precachePostEmbedProfile(queryClient, post.post.embed) - - // Cache parent author and embeds - const parent = post.reply?.parent - if (AppBskyFeedDefs.isPostView(parent)) { - precacheProfile(queryClient, parent.author) - precachePostEmbedProfile(queryClient, parent.embed) - } - } -} - -function precachePostEmbedProfile( - queryClient: QueryClient, - embed: AppBskyFeedDefs.PostView['embed'], -) { - if (AppBskyEmbedRecord.isView(embed)) { - if (AppBskyEmbedRecord.isViewRecord(embed.record)) { - precacheProfile(queryClient, embed.record.author) - } - } else if (AppBskyEmbedRecordWithMedia.isView(embed)) { - if (AppBskyEmbedRecord.isViewRecord(embed.record.record)) { - precacheProfile(queryClient, embed.record.record.author) - } - } -} - -export function precacheThreadPostProfiles( - queryClient: QueryClient, - node: ThreadNode, -) { - if (node.type === 'post') { - precacheProfile(queryClient, node.post.author) - if (node.parent) { - precacheThreadPostProfiles(queryClient, node.parent) - } - if (node.replies?.length) { - for (const reply of node.replies) { - precacheThreadPostProfiles(queryClient, reply) - } - } - } -} - async function whenAppViewReady( getAgent: () => BskyAgent, actor: string, |