Skip to content

Commit

Permalink
refactor: prevent show context menu if there is no options
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Dec 8, 2023
1 parent 64f1a31 commit 5178290
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/component/elements/ContextMenuBluePrint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export function ContextMenu<E extends ElementType = 'div'>(
const { options, onSelect, children, as: Wrapper = 'div', ...other } = props;

function handleContextMenu(event: React.MouseEvent<HTMLElement>) {
if (!Array.isArray(options) || options.length === 0) {
return;
}

const content = (
<Menu>
{options.map((option) => (
Expand Down

0 comments on commit 5178290

Please sign in to comment.