From c2bd6d6b33dc24c4321228add4fedfade93eb014 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Sun, 17 Mar 2024 10:15:01 +0000
Subject: refactor: Prepare for pagination by dropping querying bookmarks by id

---
 apps/mobile/components/bookmarks/BookmarkList.tsx | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

(limited to 'apps/mobile/components/bookmarks/BookmarkList.tsx')

diff --git a/apps/mobile/components/bookmarks/BookmarkList.tsx b/apps/mobile/components/bookmarks/BookmarkList.tsx
index 04a3d922..e7b5e5f2 100644
--- a/apps/mobile/components/bookmarks/BookmarkList.tsx
+++ b/apps/mobile/components/bookmarks/BookmarkList.tsx
@@ -4,18 +4,16 @@ import Animated, { LinearTransition } from "react-native-reanimated";
 import { api } from "@/lib/trpc";
 import { useScrollToTop } from "@react-navigation/native";
 
+import type { ZGetBookmarksRequest } from "@hoarder/trpc/types/bookmarks";
+
 import FullPageSpinner from "../ui/FullPageSpinner";
 import BookmarkCard from "./BookmarkCard";
 
 export default function BookmarkList({
-  favourited,
-  archived,
-  ids,
-  header
+  query,
+  header,
 }: {
-  favourited?: boolean;
-  archived?: boolean;
-  ids?: string[];
+  query: ZGetBookmarksRequest;
   header?: React.ReactElement;
 }) {
   const apiUtils = api.useUtils();
@@ -23,11 +21,7 @@ export default function BookmarkList({
   const flatListRef = useRef(null);
   useScrollToTop(flatListRef);
   const { data, isPending, isPlaceholderData } =
-    api.bookmarks.getBookmarks.useQuery({
-      favourited,
-      archived,
-      ids,
-    });
+    api.bookmarks.getBookmarks.useQuery(query);
 
   useEffect(() => {
     setRefreshing(isPending || isPlaceholderData);
-- 
cgit v1.2.3-70-g09d2

