about summary refs log tree commit diff
path: root/src/state/queries
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-05-17 17:03:50 -0500
committerGitHub <noreply@github.com>2024-05-17 15:03:50 -0700
commit1cdcb3e6c333b7ad5aa53676163643d7f43d1528 (patch)
treebd512fbaf93009bd00d60b34a7b97bb4e1469177 /src/state/queries
parentd02e0884c40adebe3799254395d933205b104a86 (diff)
downloadvoidsky-1cdcb3e6c333b7ad5aa53676163643d7f43d1528.tar.zst
[🐴] New chat dialog refresh (#4071)
* Checkpoint, header styled, empty

* Checkpoint, styles

* Show recent follows in initial state, finesse some styles

* Add skeleton

* Add some limits

* Fix autofocus on web, use bottom sheet input on native

* Ignore type

* Clean up edits

* Format

* Tweak icon placement

* Fix type

* use prop for dismissing keyboard

---------

Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/state/queries')
-rw-r--r--src/state/queries/actor-autocomplete.ts3
-rw-r--r--src/state/queries/profile-follows.ts13
2 files changed, 13 insertions, 3 deletions
diff --git a/src/state/queries/actor-autocomplete.ts b/src/state/queries/actor-autocomplete.ts
index 8708a244b..17b00dc26 100644
--- a/src/state/queries/actor-autocomplete.ts
+++ b/src/state/queries/actor-autocomplete.ts
@@ -20,6 +20,7 @@ export const RQKEY = (prefix: string) => [RQKEY_ROOT, prefix]
 export function useActorAutocompleteQuery(
   prefix: string,
   maintainData?: boolean,
+  limit?: number,
 ) {
   const moderationOpts = useModerationOpts()
   const {getAgent} = useAgent()
@@ -37,7 +38,7 @@ export function useActorAutocompleteQuery(
       const res = prefix
         ? await getAgent().searchActorsTypeahead({
             q: prefix,
-            limit: 8,
+            limit: limit || 8,
           })
         : undefined
       return res?.data.actors || []
diff --git a/src/state/queries/profile-follows.ts b/src/state/queries/profile-follows.ts
index 23c0dce3e..1919409c7 100644
--- a/src/state/queries/profile-follows.ts
+++ b/src/state/queries/profile-follows.ts
@@ -16,7 +16,16 @@ type RQPageParam = string | undefined
 const RQKEY_ROOT = 'profile-follows'
 export const RQKEY = (did: string) => [RQKEY_ROOT, did]
 
-export function useProfileFollowsQuery(did: string | undefined) {
+export function useProfileFollowsQuery(
+  did: string | undefined,
+  {
+    limit,
+  }: {
+    limit?: number
+  } = {
+    limit: PAGE_SIZE,
+  },
+) {
   const {getAgent} = useAgent()
   return useInfiniteQuery<
     AppBskyGraphGetFollows.OutputSchema,
@@ -30,7 +39,7 @@ export function useProfileFollowsQuery(did: string | undefined) {
     async queryFn({pageParam}: {pageParam: RQPageParam}) {
       const res = await getAgent().app.bsky.graph.getFollows({
         actor: did || '',
-        limit: PAGE_SIZE,
+        limit: limit || PAGE_SIZE,
         cursor: pageParam,
       })
       return res.data