mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-05-07 08:22:42 +08:00
fix(ContextMenu): improve handler invocation logic to prevent errors
This commit is contained in:
@@ -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' }}
|
||||
|
||||
Reference in New Issue
Block a user