From af87cc87f7319243cf42b87780f8eed26712d038 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Sat, 2 Mar 2024 20:23:06 +0000
Subject: ui: Preload the sidebar lists to avoid the spinner

---
 packages/web/app/dashboard/components/AllLists.tsx | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

(limited to 'packages/web/app/dashboard/components/AllLists.tsx')

diff --git a/packages/web/app/dashboard/components/AllLists.tsx b/packages/web/app/dashboard/components/AllLists.tsx
index e2a6b777..c8b55d73 100644
--- a/packages/web/app/dashboard/components/AllLists.tsx
+++ b/packages/web/app/dashboard/components/AllLists.tsx
@@ -6,16 +6,15 @@ import LoadingSpinner from "@/components/ui/spinner";
 import NewListModal, { useNewListModal } from "./NewListModal";
 import { Plus } from "lucide-react";
 import Link from "next/link";
+import { ZBookmarkList } from "@/lib/types/api/lists";
 
-export default function AllLists() {
-  const { data: lists } = api.lists.list.useQuery();
+export default function AllLists({initialData}: {initialData: {lists: ZBookmarkList[]}}) {
+  const { data: lists } = api.lists.list.useQuery(undefined, {
+    initialData,
+  });
 
   const { setOpen } = useNewListModal();
 
-  if (!lists) {
-    return <LoadingSpinner />;
-  }
-
   return (
     <ul className="max-h-full gap-y-2 overflow-auto text-sm font-medium">
       <NewListModal />
-- 
cgit v1.2.3-70-g09d2

