about summary refs log tree commit diff
path: root/src/state/queries/search-posts.ts
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-04-10 23:32:31 +0100
committerGitHub <noreply@github.com>2024-04-10 23:32:31 +0100
commit9007810cdb5ffc8fbdf8e2a2af6c073b76b318f3 (patch)
tree13b19716a4de5373d6c74039f7d8d674ad9ef893 /src/state/queries/search-posts.ts
parent310d86544028e0b168be3f0c55259bcc852aaa8e (diff)
downloadvoidsky-9007810cdb5ffc8fbdf8e2a2af6c073b76b318f3.tar.zst
Search - only enable queries once tab is active (#3471)
* only enable queries once tab is active

* remove hasBeenTrue hook

* make enabled optional
Diffstat (limited to 'src/state/queries/search-posts.ts')
-rw-r--r--src/state/queries/search-posts.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/state/queries/search-posts.ts b/src/state/queries/search-posts.ts
index ef8b08358..1822577c9 100644
--- a/src/state/queries/search-posts.ts
+++ b/src/state/queries/search-posts.ts
@@ -19,9 +19,11 @@ const searchPostsQueryKey = ({query, sort}: {query: string; sort?: string}) => [
 export function useSearchPostsQuery({
   query,
   sort,
+  enabled,
 }: {
   query: string
   sort?: 'top' | 'latest'
+  enabled?: boolean
 }) {
   return useInfiniteQuery<
     AppBskyFeedSearchPosts.OutputSchema,
@@ -47,6 +49,7 @@ export function useSearchPostsQuery({
     },
     initialPageParam: undefined,
     getNextPageParam: lastPage => lastPage.cursor,
+    enabled,
   })
 }