fix: update keyboard shortcut abort logic
Use current session activity to determine when abort shortcuts are available Prevent abort priming when there is no active session
This commit is contained in:
@@ -5,7 +5,7 @@ import { useSelectionStore } from '@/sync/selection-store';
|
||||
import * as sessionActions from '@/sync/session-actions';
|
||||
import { useUIStore } from '@/stores/useUIStore';
|
||||
import { useThemeSystem } from '@/contexts/useThemeSystem';
|
||||
import { useAssistantStatus } from '@/hooks/useAssistantStatus';
|
||||
import { useCurrentSessionActivity } from '@/hooks/useSessionActivity';
|
||||
import { createWorktreeSession } from '@/lib/worktreeSessionCreator';
|
||||
import { useConfigStore } from '@/stores/useConfigStore';
|
||||
import { canUseElectronDesktopIPC, invokeDesktop, isVSCodeRuntime } from '@/lib/desktop';
|
||||
@@ -43,7 +43,7 @@ export const useKeyboardShortcuts = () => {
|
||||
const currentDirectory = useDirectoryStore((s) => s.currentDirectory);
|
||||
const activeProject = useProjectsStore((s) => s.getActiveProject());
|
||||
const { themeMode, setThemeMode } = useThemeSystem();
|
||||
const { working } = useAssistantStatus();
|
||||
const { phase: sessionPhase } = useCurrentSessionActivity();
|
||||
const abortPrimedUntilRef = React.useRef<number | null>(null);
|
||||
const abortPrimedTimeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const themeModeRef = React.useRef(themeMode);
|
||||
@@ -569,7 +569,7 @@ export const useKeyboardShortcuts = () => {
|
||||
|
||||
// Double-ESC abort logic - only when on chat tab with no overlays
|
||||
const sessionId = currentSessionId;
|
||||
const canAbortNow = working.canAbort && Boolean(sessionId);
|
||||
const canAbortNow = sessionPhase !== 'idle' && Boolean(sessionId);
|
||||
if (!canAbortNow) {
|
||||
resetAbortPriming();
|
||||
return;
|
||||
@@ -631,7 +631,7 @@ export const useKeyboardShortcuts = () => {
|
||||
setPromptNavigatorPanelOpen,
|
||||
toggleExpandedInput,
|
||||
setThemeMode,
|
||||
working,
|
||||
sessionPhase,
|
||||
armAbortPrompt,
|
||||
resetAbortPriming,
|
||||
currentSessionId,
|
||||
|
||||
Reference in New Issue
Block a user