update endpoint
This commit is contained in:
@@ -15,7 +15,6 @@ import {useAgent} from '#/state/session'
|
||||
|
||||
export type QueryProps = {
|
||||
limit?: number
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
export const getSuggestedUsersForDiscoverQueryKeyRoot =
|
||||
@@ -29,7 +28,6 @@ export function useGetSuggestedUsersForDiscoverQuery(props: QueryProps = {}) {
|
||||
const {data: preferences} = usePreferencesQuery()
|
||||
|
||||
return useQuery({
|
||||
enabled: props.enabled ?? true,
|
||||
staleTime: STALE.MINUTES.THREE,
|
||||
queryKey: createGetSuggestedUsersForDiscoverQueryKey({limit: props.limit}),
|
||||
queryFn: async () => {
|
||||
@@ -75,33 +73,3 @@ export function* findAllProfilesInQueryData(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects every DID currently cached under any `getSuggestedUsersForDiscover`
|
||||
* query. Used by the See More dialog's For You tab to filter out profiles the
|
||||
* viewer has already been shown by the home-feed interstitial (the endpoint
|
||||
* has no cursor/offset, so we dedup client-side).
|
||||
*
|
||||
* The query key root is shared with `getSuggestedUsersForSeeMore`, so we
|
||||
* narrow by key length (Discover keys are `[root, limit]`, SeeMore keys are
|
||||
* `[root, category, limit]`).
|
||||
*/
|
||||
export function getAllDidsInDiscoverCache(
|
||||
queryClient: QueryClient,
|
||||
): Set<string> {
|
||||
const dids = new Set<string>()
|
||||
const responses =
|
||||
queryClient.getQueriesData<AppBskyUnspeccedGetSuggestedUsersForDiscover.OutputSchema>(
|
||||
{
|
||||
queryKey: [getSuggestedUsersForDiscoverQueryKeyRoot],
|
||||
},
|
||||
)
|
||||
for (const [key, response] of responses) {
|
||||
if (!response) continue
|
||||
if (key.length !== 2) continue
|
||||
for (const actor of response.actors) {
|
||||
dids.add(actor.did)
|
||||
}
|
||||
}
|
||||
return dids
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user