From 353e5d6374c77a2744590a5bfd3329672009b281 Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Sun, 22 Dec 2024 16:17:22 +0000
Subject: feat: Add basic pagination to searchBookmarks tRPC

---
 apps/web/app/dashboard/search/page.tsx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'apps/web/app/dashboard/search/page.tsx')

diff --git a/apps/web/app/dashboard/search/page.tsx b/apps/web/app/dashboard/search/page.tsx
index a239550c..beae73b8 100644
--- a/apps/web/app/dashboard/search/page.tsx
+++ b/apps/web/app/dashboard/search/page.tsx
@@ -6,12 +6,18 @@ import { FullPageSpinner } from "@/components/ui/full-page-spinner";
 import { useBookmarkSearch } from "@/lib/hooks/bookmark-search";
 
 function SearchComp() {
-  const { data } = useBookmarkSearch();
+  const { data, hasNextPage, fetchNextPage, isFetchingNextPage } =
+    useBookmarkSearch();
 
   return (
     <div className="flex flex-col gap-3">
       {data ? (
-        <BookmarksGrid bookmarks={data.bookmarks} />
+        <BookmarksGrid
+          hasNextPage={hasNextPage}
+          fetchNextPage={fetchNextPage}
+          isFetchingNextPage={isFetchingNextPage}
+          bookmarks={data.pages.flatMap((b) => b.bookmarks)}
+        />
       ) : (
         <FullPageSpinner />
       )}
-- 
cgit v1.3-1-g0d28

