aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/web/app/dashboard/components/AllLists.tsx11
-rw-r--r--packages/web/app/dashboard/components/Sidebar.tsx5
2 files changed, 9 insertions, 7 deletions
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 />
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 />