Skip to content

Commit f65bc86

Browse files
committed
fix hydration
1 parent 703407d commit f65bc86

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/app-layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ export function AppLayout({ children, initialSidebarWidth, initialSidebarOpen }:
8181
})
8282
const [sidebarWidth, setSidebarWidthState] = useState(initialSidebarWidth || getSidebarWidth())
8383
const [isResizing, setIsResizing] = useState(false)
84-
const [isDesktop, setIsDesktop] = useState(() => typeof window !== 'undefined' && window.innerWidth >= 1024)
84+
// Always start as false to match SSR, then update in useEffect after hydration
85+
const [isDesktop, setIsDesktop] = useState(false)
8586
const router = useRouter()
8687

8788
// Update sidebar width and save to cookie

0 commit comments

Comments
 (0)