mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add known followers to shadow cache (#4517)

authored by

Eric Bailey and committed by
GitHub
fe3f872d 4c0f0378

+32 -2
+2
src/state/cache/profile-shadow.ts
··· 5 5 6 6 import {batchedUpdates} from '#/lib/batchedUpdates' 7 7 import {findAllProfilesInQueryData as findAllProfilesInActorSearchQueryData} from '../queries/actor-search' 8 + import {findAllProfilesInQueryData as findAllProfilesInKnownFollowersQueryData} from '../queries/known-followers' 8 9 import {findAllProfilesInQueryData as findAllProfilesInListMembersQueryData} from '../queries/list-members' 9 10 import {findAllProfilesInQueryData as findAllProfilesInListConvosQueryData} from '../queries/messages/list-converations' 10 11 import {findAllProfilesInQueryData as findAllProfilesInMyBlockedAccountsQueryData} from '../queries/my-blocked-accounts' ··· 111 112 yield* findAllProfilesInListConvosQueryData(queryClient, did) 112 113 yield* findAllProfilesInFeedsQueryData(queryClient, did) 113 114 yield* findAllProfilesInPostThreadQueryData(queryClient, did) 115 + yield* findAllProfilesInKnownFollowersQueryData(queryClient, did) 114 116 }
+30 -2
src/state/queries/known-followers.ts
··· 1 - import {AppBskyGraphGetKnownFollowers} from '@atproto/api' 2 - import {InfiniteData, QueryKey, useInfiniteQuery} from '@tanstack/react-query' 1 + import {AppBskyActorDefs, AppBskyGraphGetKnownFollowers} from '@atproto/api' 2 + import { 3 + InfiniteData, 4 + QueryClient, 5 + QueryKey, 6 + useInfiniteQuery, 7 + } from '@tanstack/react-query' 3 8 4 9 import {useAgent} from '#/state/session' 5 10 ··· 32 37 enabled: !!did, 33 38 }) 34 39 } 40 + 41 + export function* findAllProfilesInQueryData( 42 + queryClient: QueryClient, 43 + did: string, 44 + ): Generator<AppBskyActorDefs.ProfileView, void> { 45 + const queryDatas = queryClient.getQueriesData< 46 + InfiniteData<AppBskyGraphGetKnownFollowers.OutputSchema> 47 + >({ 48 + queryKey: [RQKEY_ROOT], 49 + }) 50 + for (const [_queryKey, queryData] of queryDatas) { 51 + if (!queryData?.pages) { 52 + continue 53 + } 54 + for (const page of queryData?.pages) { 55 + for (const follow of page.followers) { 56 + if (follow.did === did) { 57 + yield follow 58 + } 59 + } 60 + } 61 + } 62 + }