Fix SidebarTrigger context handling to prevent null reference errors (#156)

This commit is contained in:
Giancarlo Buomprisco
2025-02-10 07:17:19 +07:00
committed by GitHub
parent 92ad383567
commit 95d27aa85b

View File

@@ -296,7 +296,13 @@ const SidebarTrigger: React.FC<React.ComponentProps<typeof Button>> = ({
onClick,
...props
}) => {
const { toggleSidebar } = useSidebar();
const context = React.useContext(SidebarContext);
if (!context) {
return null;
}
const { toggleSidebar } = context;
return (
<Button