Fix SidebarTrigger context handling to prevent null reference errors (#156)
This commit is contained in:
committed by
GitHub
parent
92ad383567
commit
95d27aa85b
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user