fix(ContextMenu): improve handler invocation logic to prevent errors

This commit is contained in:
shiyu
2026-03-13 23:01:41 +08:00
parent ef1fe1cce8
commit f96a4dce11

View File

@@ -260,7 +260,8 @@ export const ContextMenu: React.FC<ContextMenuProps> = (props) => {
selectable={false}
onClick={({ key }) => {
const handler = handlerMap.get(String(key));
if (handler) handler();
if (!handler) return;
handler();
onClose();
}}
style={{ borderRadius: token.borderRadius, background: 'transparent', border: 'none' }}