Fix: move command palette open check before workspace command dispatch

Workspace commands (via isWorkspaceCommandId) and standalone terminal
commands were dispatched before the useCommandPaletteStore.getState().open
guard, causing shortcuts like Mod+W, Mod+[, Mod+] to fire while the
command palette dialog was open. Move the palette check to run immediately
after resolving the shortcut command, consistent with the guard pattern
in ChatView.tsx.
This commit is contained in:
Cursor Agent committed 2026-04-15 00:53:04 +00:00
1 parent 5c8504d602
commit fc52f7f4cf
1 file changed
+4 -4
+4 -4
View File
@@ -42,6 +42,10 @@ function ChatRouteGlobalShortcuts() {
terminalOpen,
},
});
if (useCommandPaletteStore.getState().open) {
return;
}
const isFocusedStandaloneTerminal = focusedWorkspaceSurface?.kind === "terminal";
if (command && isWorkspaceCommandId(command)) {
event.preventDefault();
@@ -73,10 +77,6 @@ function ChatRouteGlobalShortcuts() {
}
}
if (useCommandPaletteStore.getState().open) {
return;
}
if (event.key === "Escape" && selectedThreadKeysSize > 0) {
event.preventDefault();
clearSelection();