about summary refs log tree commit diff
path: root/src/state/queries/suggested-follows.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-06-21 14:50:49 -0500
committerGitHub <noreply@github.com>2024-06-21 14:50:49 -0500
commitcb376479493dbc3a24876449f6466789ddcef6ea (patch)
tree7f4445d01a87b5e614974037b5d542e29ebafe33 /src/state/queries/suggested-follows.ts
parent55812b03940852f1f91cd0a46b5c093601c854a9 (diff)
downloadvoidsky-cb376479493dbc3a24876449f6466789ddcef6ea.tar.zst
Fetch more than 3 suggested follows after first load (#4595)
* Fetch more than 3 sugg follows after first load

* Preview handling via overfetching
Diffstat (limited to 'src/state/queries/suggested-follows.ts')
-rw-r--r--src/state/queries/suggested-follows.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/state/queries/suggested-follows.ts b/src/state/queries/suggested-follows.ts
index 40251d43d..a1244721a 100644
--- a/src/state/queries/suggested-follows.ts
+++ b/src/state/queries/suggested-follows.ts
@@ -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,
         },
         {