Fix profile follow from Likes (#3401)
parent
4cc57f4bfd
commit
19b1721ef3
|
@ -1,9 +1,9 @@
|
||||||
import {AppBskyActorDefs, AppBskyFeedGetLikes} from '@atproto/api'
|
import {AppBskyActorDefs, AppBskyFeedGetLikes} from '@atproto/api'
|
||||||
import {
|
import {
|
||||||
useInfiniteQuery,
|
|
||||||
InfiniteData,
|
InfiniteData,
|
||||||
QueryClient,
|
QueryClient,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
|
useInfiniteQuery,
|
||||||
} from '@tanstack/react-query'
|
} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {getAgent} from '#/state/session'
|
import {getAgent} from '#/state/session'
|
||||||
|
@ -12,7 +12,8 @@ const PAGE_SIZE = 30
|
||||||
type RQPageParam = string | undefined
|
type RQPageParam = string | undefined
|
||||||
|
|
||||||
// TODO refactor invalidate on mutate?
|
// 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) {
|
export function useLikedByQuery(resolvedUri: string | undefined) {
|
||||||
return useInfiniteQuery<
|
return useInfiniteQuery<
|
||||||
|
@ -44,7 +45,7 @@ export function* findAllProfilesInQueryData(
|
||||||
const queryDatas = queryClient.getQueriesData<
|
const queryDatas = queryClient.getQueriesData<
|
||||||
InfiniteData<AppBskyFeedGetLikes.OutputSchema>
|
InfiniteData<AppBskyFeedGetLikes.OutputSchema>
|
||||||
>({
|
>({
|
||||||
queryKey: ['post-liked-by'],
|
queryKey: [RQKEY_ROOT],
|
||||||
})
|
})
|
||||||
for (const [_queryKey, queryData] of queryDatas) {
|
for (const [_queryKey, queryData] of queryDatas) {
|
||||||
if (!queryData?.pages) {
|
if (!queryData?.pages) {
|
||||||
|
|
Loading…
Reference in New Issue