Fetch more than 3 suggested follows after first load (#4595)
* Fetch more than 3 sugg follows after first load * Preview handling via overfetching
This commit is contained in:
parent
55812b0394
commit
cb37647949
2 changed files with 26 additions and 8 deletions
|
@ -34,13 +34,14 @@ const suggestedFollowsByActorQueryKey = (did: string) => [
|
|||
did,
|
||||
]
|
||||
|
||||
type SuggestedFollowsOptions = {limit?: number}
|
||||
type SuggestedFollowsOptions = {limit?: number; subsequentPageLimit?: number}
|
||||
|
||||
export function useSuggestedFollowsQuery(options?: SuggestedFollowsOptions) {
|
||||
const {currentAccount} = useSession()
|
||||
const agent = useAgent()
|
||||
const moderationOpts = useModerationOpts()
|
||||
const {data: preferences} = usePreferencesQuery()
|
||||
const limit = options?.limit || 25
|
||||
|
||||
return useInfiniteQuery<
|
||||
AppBskyActorGetSuggestions.OutputSchema,
|
||||
|
@ -54,9 +55,13 @@ export function useSuggestedFollowsQuery(options?: SuggestedFollowsOptions) {
|
|||
queryKey: suggestedFollowsQueryKey(options),
|
||||
queryFn: async ({pageParam}) => {
|
||||
const contentLangs = getContentLanguages().join(',')
|
||||
const maybeDifferentLimit =
|
||||
options?.subsequentPageLimit && pageParam
|
||||
? options.subsequentPageLimit
|
||||
: limit
|
||||
const res = await agent.app.bsky.actor.getSuggestions(
|
||||
{
|
||||
limit: options?.limit || 25,
|
||||
limit: maybeDifferentLimit,
|
||||
cursor: pageParam,
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue