We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b591db9 + 7c7de97 commit 52efbc8Copy full SHA for 52efbc8
1 file changed
components/Sidebar.js
@@ -1,5 +1,5 @@
1
import Link from 'next/link';
2
-import { useMemo, useState } from 'react';
+import { useEffect, useMemo, useState } from 'react';
3
4
function SidebarSection({ section, currentPath }) {
5
const initialOpen = useMemo(() => {
@@ -11,6 +11,13 @@ function SidebarSection({ section, currentPath }) {
11
}, [section, currentPath]);
12
13
const [isOpen, setIsOpen] = useState(initialOpen);
14
+
15
+ useEffect(() => {
16
+ if (initialOpen) {
17
+ setIsOpen(true);
18
+ }
19
+ }, [initialOpen]);
20
21
const collapsible = section.collapsible !== false;
22
23
return (
0 commit comments