fix: 修复 ESC 键重复触发 handleNavigateBack 的问题

This commit is contained in:
LaZzyMan 2026-02-25 11:09:04 +08:00
parent fe0ec8049c
commit 4df4681dc8

View file

@ -562,16 +562,14 @@ export const MCPManagementDialog: React.FC<MCPManagementDialogProps> = ({
);
}, [getCurrentStep, servers.length]);
// ESC键处理
// ESC 键处理 - 仅关闭对话框,子组件的返回由各自处理避免重复触发
useKeypress(
(key) => {
if (key.name === 'escape') {
const currentStep = getCurrentStep();
if (currentStep === MCP_MANAGEMENT_STEPS.SERVER_LIST) {
onClose();
} else {
handleNavigateBack();
}
if (
key.name === 'escape' &&
getCurrentStep() === MCP_MANAGEMENT_STEPS.SERVER_LIST
) {
onClose();
}
},
{ isActive: true },