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/Sidebar.tsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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

diff --git a/packages/web/app/dashboard/components/Sidebar.tsx b/packages/web/app/dashboard/components/Sidebar.tsx
index c6282a6b..a5c1d7a5 100644
--- a/packages/web/app/dashboard/components/Sidebar.tsx
+++ b/packages/web/app/dashboard/components/Sidebar.tsx
@@ -7,6 +7,7 @@ import SidebarProfileOptions from "./SidebarProfileOptions";
 import { Separator } from "@/components/ui/separator";
 import AllLists from "./AllLists";
 import serverConfig from "@hoarder/shared/config";
+import { api } from "@/server/api/client";
 
 export default async function Sidebar() {
   const session = await getServerAuthSession();
@@ -14,6 +15,8 @@ export default async function Sidebar() {
     redirect("/");
   }
 
+  const lists = await api.lists.list();
+
   return (
     <aside className="flex h-screen w-60 flex-col gap-5 border-r p-4">
       <Link href={"/dashboard/bookmarks"}>
@@ -53,7 +56,7 @@ export default async function Sidebar() {
         </ul>
       </div>
       <Separator />
-      <AllLists />
+      <AllLists initialData={lists} />
       <div className="mt-auto flex justify-between justify-self-end">
         <div className="my-auto"> {session.user.name} </div>
         <SidebarProfileOptions />
-- 
cgit v1.2.3-70-g09d2

