Skip to content

Commit

Permalink
Add extra check for sidebar item type
Browse files Browse the repository at this point in the history
  • Loading branch information
pudek357 committed Dec 27, 2023
1 parent 421312a commit 0f48a47
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/picasso/src/SidebarMenu/SidebarMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React, { forwardRef, useCallback, useEffect } from 'react'
import Menu from '../Menu'
import { useSidebarContext } from '../PageSidebar/SidebarContextProvider'
import type { SidebarItemProps } from '../SidebarItem'
import { useSubMenuContext } from '../SidebarItem'
import SidebarItem, { useSubMenuContext } from '../SidebarItem'
import styles from './styles'

export interface Props extends BaseProps, HTMLAttributes<HTMLUListElement> {
Expand Down Expand Up @@ -50,7 +50,7 @@ export const SidebarMenu = forwardRef<HTMLUListElement, Props>(
}, [parentSidebarItemIndex, setExpandedItemKey, children])

const items = React.Children.map(children, (child, index) => {
if (React.isValidElement(child)) {
if (React.isValidElement(child) && child.type === SidebarItem) {
const itemProps: Partial<SidebarItemProps> = {
variant,
isSubMenu,
Expand Down

0 comments on commit 0f48a47

Please sign in to comment.