From 29b7c5c8d10d5315fea27fc25f1f153c6c12dfbf Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Sat, 2 Mar 2024 20:45:11 +0000
Subject: fix: Fix hydration in list view caused by the spinner

---
 packages/web/app/dashboard/components/AllLists.tsx | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 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 c8b55d73..8903c82a 100644
--- a/packages/web/app/dashboard/components/AllLists.tsx
+++ b/packages/web/app/dashboard/components/AllLists.tsx
@@ -2,17 +2,21 @@
 
 import { api } from "@/lib/trpc";
 import SidebarItem from "./SidebarItem";
-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({initialData}: {initialData: {lists: ZBookmarkList[]}}) {
-  const { data: lists } = api.lists.list.useQuery(undefined, {
+export default function AllLists({
+  initialData,
+}: {
+  initialData: { lists: ZBookmarkList[] };
+}) {
+  let { data: lists } = api.lists.list.useQuery(undefined, {
     initialData,
   });
-
+  // TODO: This seems to be a bug in react query
+  lists ||= initialData;
   const { setOpen } = useNewListModal();
 
   return (
-- 
cgit v1.2.3-70-g09d2

