Skip to content

Commit

Permalink
Fix profile follow from Likes (#3401)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Apr 4, 2024
1 parent 4cc57f4 commit 19b1721
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/state/queries/post-liked-by.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {AppBskyActorDefs, AppBskyFeedGetLikes} from '@atproto/api'
import {
useInfiniteQuery,
InfiniteData,
QueryClient,
QueryKey,
useInfiniteQuery,
} from '@tanstack/react-query'

import {getAgent} from '#/state/session'
Expand All @@ -12,7 +12,8 @@ const PAGE_SIZE = 30
type RQPageParam = string | undefined

// TODO refactor invalidate on mutate?
export const RQKEY = (resolvedUri: string) => ['liked-by', resolvedUri]
const RQKEY_ROOT = 'liked-by'
export const RQKEY = (resolvedUri: string) => [RQKEY_ROOT, resolvedUri]

export function useLikedByQuery(resolvedUri: string | undefined) {
return useInfiniteQuery<
Expand Down Expand Up @@ -44,7 +45,7 @@ export function* findAllProfilesInQueryData(
const queryDatas = queryClient.getQueriesData<
InfiniteData<AppBskyFeedGetLikes.OutputSchema>
>({
queryKey: ['post-liked-by'],
queryKey: [RQKEY_ROOT],
})
for (const [_queryKey, queryData] of queryDatas) {
if (!queryData?.pages) {
Expand Down

0 comments on commit 19b1721

Please sign in to comment.