From 51782908b254f9ef3c86349593b669e205b8712b Mon Sep 17 00:00:00 2001 From: hamed musallam Date: Fri, 8 Dec 2023 10:12:27 +0100 Subject: [PATCH] refactor: prevent show context menu if there is no options --- src/component/elements/ContextMenuBluePrint.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/component/elements/ContextMenuBluePrint.tsx b/src/component/elements/ContextMenuBluePrint.tsx index 2dd07237ea..a36d051399 100644 --- a/src/component/elements/ContextMenuBluePrint.tsx +++ b/src/component/elements/ContextMenuBluePrint.tsx @@ -33,6 +33,10 @@ export function ContextMenu( const { options, onSelect, children, as: Wrapper = 'div', ...other } = props; function handleContextMenu(event: React.MouseEvent) { + if (!Array.isArray(options) || options.length === 0) { + return; + } + const content = ( {options.map((option) => (