aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/lib/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/lib/hooks')
-rw-r--r--apps/web/lib/hooks/bookmark-search.ts32
1 files changed, 22 insertions, 10 deletions
diff --git a/apps/web/lib/hooks/bookmark-search.ts b/apps/web/lib/hooks/bookmark-search.ts
index ffdf402d..9890ac6f 100644
--- a/apps/web/lib/hooks/bookmark-search.ts
+++ b/apps/web/lib/hooks/bookmark-search.ts
@@ -50,16 +50,25 @@ export function useDoBookmarkSearch() {
export function useBookmarkSearch() {
const { searchQuery } = useSearchQuery();
- const { data, isPending, isPlaceholderData, error } =
- api.bookmarks.searchBookmarks.useQuery(
- {
- text: searchQuery,
- },
- {
- placeholderData: keepPreviousData,
- gcTime: 0,
- },
- );
+ const {
+ data,
+ isPending,
+ isPlaceholderData,
+ error,
+ hasNextPage,
+ fetchNextPage,
+ isFetchingNextPage,
+ } = api.bookmarks.searchBookmarks.useInfiniteQuery(
+ {
+ text: searchQuery,
+ },
+ {
+ placeholderData: keepPreviousData,
+ gcTime: 0,
+ initialCursor: null,
+ getNextPageParam: (lastPage) => lastPage.nextCursor,
+ },
+ );
if (error) {
throw error;
@@ -71,5 +80,8 @@ export function useBookmarkSearch() {
data,
isPending,
isPlaceholderData,
+ hasNextPage,
+ fetchNextPage,
+ isFetchingNextPage,
};
}