mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-09-05 23:57:19 +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}
|
selectable={false}
|
||||||
onClick={({ key }) => {
|
onClick={({ key }) => {
|
||||||
const handler = handlerMap.get(String(key));
|
const handler = handlerMap.get(String(key));
|
||||||
if (handler) handler();
|
if (!handler) return;
|
||||||
|
handler();
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
style={{ borderRadius: token.borderRadius, background: 'transparent', border: 'none' }}
|
style={{ borderRadius: token.borderRadius, background: 'transparent', border: 'none' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user