Skip to content

Commit 3cb7dc2

Browse files
tecoholicfarhaanbukhsh
authored andcommitted
fix: sidebar does not forget previous state when closed
1 parent 82eb4aa commit 3cb7dc2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/CourseHeaderButton.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@ export function CourseHeaderButton() {
1010
const {
1111
sidebarOpen,
1212
setSidebarOpen,
13+
setActiveBlock,
14+
setFilterUnit,
15+
setFilteredBlocks,
1316
} = useAspectsSidebarContext();
1417
return (
1518
<Button
1619
variant={sidebarOpen ? 'primary' : 'outline-primary'}
1720
iconBefore={AutoGraph}
18-
onClick={() => setSidebarOpen(!sidebarOpen)}
21+
onClick={() => {
22+
setSidebarOpen(!sidebarOpen);
23+
setFilterUnit(null);
24+
setActiveBlock(null);
25+
setFilteredBlocks([]);
26+
}}
1927
>
2028
{intl.formatMessage(messages.analyticsLabel)}
2129
</Button>

0 commit comments

Comments
 (0)