From a645c34bdd65ef35ba3305f742c3f3113b927c82 Mon Sep 17 00:00:00 2001 From: Mohamad Salimi Date: Tue, 21 May 2024 23:58:41 +0800 Subject: [PATCH] fix(sidebar): fix inconsistent sidebar with after page reload --- app/(admin)/layout.tsx | 2 ++ components/admin-panel/sidebar.tsx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/(admin)/layout.tsx b/app/(admin)/layout.tsx index 510d7c3..488aad4 100644 --- a/app/(admin)/layout.tsx +++ b/app/(admin)/layout.tsx @@ -15,6 +15,8 @@ export default function AdminLayout({ }) { const sidebar = useStore(useSidebarToggle, (state) => state); + if (!sidebar) return null; + return ( diff --git a/components/admin-panel/sidebar.tsx b/components/admin-panel/sidebar.tsx index 478d435..51fc37e 100644 --- a/components/admin-panel/sidebar.tsx +++ b/components/admin-panel/sidebar.tsx @@ -11,6 +11,8 @@ import { SidebarToggle } from '@/components/admin-panel/sidebar-toggle'; export function Sidebar() { const sidebar = useStore(useSidebarToggle, (state) => state); + if (!sidebar) return null; + return (