fix: remove hasSelectedAgent gate from Cmd+E and focus mode shortcuts
The hasSelectedAgent condition was redundantly gating Cmd+E (toggle right sidebar) and Cmd+Shift+F (toggle focus mode) behind a pathname check that Cmd+B and Cmd+. didn't require. The action handler already guards against invalid states, making the when-clause check unnecessary and broken on the dev branch's navigation flow.
This commit is contained in:
@@ -15,7 +15,6 @@ import {
|
||||
type MessageInputKeyboardActionKind,
|
||||
type KeyboardShortcutPayload,
|
||||
} from "@/keyboard/actions";
|
||||
import { canToggleFileExplorerShortcut } from "@/keyboard/keyboard-shortcut-routing";
|
||||
import { keyboardActionDispatcher } from "@/keyboard/keyboard-action-dispatcher";
|
||||
import {
|
||||
type ChordState,
|
||||
@@ -32,7 +31,6 @@ export function useKeyboardShortcuts({
|
||||
enabled,
|
||||
isMobile,
|
||||
toggleAgentList,
|
||||
selectedAgentId,
|
||||
toggleFileExplorer,
|
||||
toggleBothSidebars,
|
||||
toggleFocusMode,
|
||||
@@ -41,7 +39,6 @@ export function useKeyboardShortcuts({
|
||||
enabled: boolean;
|
||||
isMobile: boolean;
|
||||
toggleAgentList: () => void;
|
||||
selectedAgentId?: string;
|
||||
toggleFileExplorer?: () => void;
|
||||
toggleBothSidebars?: () => void;
|
||||
toggleFocusMode?: () => void;
|
||||
@@ -262,19 +259,9 @@ export function useKeyboardShortcuts({
|
||||
}
|
||||
return true;
|
||||
case "sidebar.toggle.right":
|
||||
if (!toggleFileExplorer) {
|
||||
return false;
|
||||
if (toggleFileExplorer) {
|
||||
toggleFileExplorer();
|
||||
}
|
||||
if (
|
||||
!canToggleFileExplorerShortcut({
|
||||
selectedAgentId,
|
||||
pathname,
|
||||
toggleFileExplorer,
|
||||
})
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
toggleFileExplorer();
|
||||
return true;
|
||||
case "view.toggle.focus":
|
||||
if (toggleFocusMode) {
|
||||
@@ -353,11 +340,6 @@ export function useKeyboardShortcuts({
|
||||
isDesktop: isDesktopApp,
|
||||
focusScope,
|
||||
commandCenterOpen: store.commandCenterOpen,
|
||||
hasSelectedAgent: canToggleFileExplorerShortcut({
|
||||
selectedAgentId,
|
||||
pathname,
|
||||
toggleFileExplorer,
|
||||
}),
|
||||
},
|
||||
chordState: chordStateRef.current,
|
||||
onChordReset: () => {
|
||||
@@ -438,7 +420,6 @@ export function useKeyboardShortcuts({
|
||||
openProjectPickerAction,
|
||||
pathname,
|
||||
resetModifiers,
|
||||
selectedAgentId,
|
||||
toggleAgentList,
|
||||
toggleFileExplorer,
|
||||
toggleFocusMode,
|
||||
|
||||
Reference in New Issue
Block a user