diff options
author | Hailey <me@haileyok.com> | 2024-04-26 22:31:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-27 06:31:07 +0100 |
commit | 7eb1444f2c82cd25a77445b82178b7299e8452c7 (patch) | |
tree | c160dcafad17ec148f3d0e9b5b03cbf326255821 /src/state/queries/profile.ts | |
parent | ce85375c856549371e1e561e21bb5932baca8ea6 (diff) | |
download | voidsky-7eb1444f2c82cd25a77445b82178b7299e8452c7.tar.zst |
remove precacheThreadPostProfiles (#3729)
* remove `precacheThreadPostProfiles` * add `displayName` to `PreviewableUserAvatar` * memo * use `precacheProfile` * pass `profile` directly to `PreviewableUserAvatar` * update the `UserAvatar`'s props * remove feed cache * one more spot * rm unused queryClient * Don't call fn unnecessarily * Preload for display name too * try notification item * add to feeditem * and finally, precache for post threads * timestamp * Fix * onBeforePress --------- Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
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, |