Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: hydration error

Marc Seitz96762ec34d3d
diff --git a/components/layouts/app.tsx b/components/layouts/app.tsx
index 5cc620e3..ae32c3fc 100644
--- a/components/layouts/app.tsx
+++ b/components/layouts/app.tsx
@@ -22,10 +22,15 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
const router = useRouter();
const isDataroom = router.pathname.startsWith("/datarooms/[id]");
- const cookieValue = Cookies.get(SIDEBAR_COOKIE_NAME);
- const defaultOpen = cookieValue === undefined ? true : cookieValue === "true";
+ const [sidebarOpen, setSidebarOpen] = useState(true);
- const [sidebarOpen, setSidebarOpen] = useState(defaultOpen);
+ // Sync with cookie on mount (client-side only)
+ useEffect(() => {
+ const cookieValue = Cookies.get(SIDEBAR_COOKIE_NAME);
+ if (cookieValue !== undefined) {
+ setSidebarOpen(cookieValue === "true");
+ }
+ }, []);
// Close sidebar when entering a dataroom
useEffect(() => {