refactor(surface): remove the main-area surface concept entirely
activeSurface was permanently 'chat' after the legacy mobile layout
removal, so the whole concept is gone: the store field, surfaceGuard,
setActiveSurface/setSurfaceGuard, the per-runtime surface memory in
prepare/restoreForRuntimeSwitch, and WorkspaceSurface itself. All ~30
setActiveSurface('chat') call sites were no-ops and are deleted;
always-true 'is the chat active' checks in keyboard shortcuts, Header
and ChatContainer are unconditional now. FilesView's dirty-file guard
kept its file-switch and close protection but drops the surface-switch
branch nothing could trigger. TerminalView visibility comes only from
its callers. The router keeps parsing legacy ?tab= links (they open the
matching context-panel surface) via its own RouteTab type and no longer
serializes a tab or diff file into URLs — desktop URLs never carried
them anyway.
This commit is contained in:
@@ -59,7 +59,6 @@ export const useKeyboardShortcuts = () => {
|
||||
}, [currentShortcutDirectory]);
|
||||
const isMobile = useUIStore((s) => s.isMobile);
|
||||
const setSessionSwitcherOpen = useUIStore((s) => s.setSessionSwitcherOpen);
|
||||
const setActiveSurface = useUIStore((s) => s.setActiveSurface);
|
||||
const setSettingsDialogOpen = useUIStore((s) => s.setSettingsDialogOpen);
|
||||
const setModelSelectorOpen = useUIStore((s) => s.setModelSelectorOpen);
|
||||
const setTimelineDialogOpen = useUIStore((s) => s.setTimelineDialogOpen);
|
||||
@@ -154,7 +153,6 @@ export const useKeyboardShortcuts = () => {
|
||||
isAboutDialogOpen,
|
||||
isMultiRunLauncherOpen,
|
||||
isImagePreviewOpen,
|
||||
activeSurface,
|
||||
isPromptNavigatorPanelOpen,
|
||||
} = useUIStore.getState();
|
||||
|
||||
@@ -183,7 +181,7 @@ export const useKeyboardShortcuts = () => {
|
||||
}
|
||||
|
||||
const hasOverlay = isCommandPaletteOpen || isHelpDialogOpen || isSessionSwitcherOpen || isAboutDialogOpen || isMultiRunLauncherOpen || isImagePreviewOpen;
|
||||
const isChatActive = activeSurface === 'chat';
|
||||
const isChatActive = true;
|
||||
|
||||
if (hasOverlay || !isChatActive) {
|
||||
resetAbortPriming();
|
||||
@@ -245,7 +243,6 @@ export const useKeyboardShortcuts = () => {
|
||||
|
||||
if (eventMatchesShortcut(e, combo('toggle_prompt_navigator'))) {
|
||||
const {
|
||||
activeSurface,
|
||||
promptNavigatorEnabled,
|
||||
isSettingsDialogOpen,
|
||||
isCommandPaletteOpen,
|
||||
@@ -257,7 +254,7 @@ export const useKeyboardShortcuts = () => {
|
||||
isImagePreviewOpen,
|
||||
} = useUIStore.getState();
|
||||
|
||||
if (!promptNavigatorEnabled || isMobile || isVSCodeRuntime() || activeSurface !== 'chat') {
|
||||
if (!promptNavigatorEnabled || isMobile || isVSCodeRuntime()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -308,7 +305,6 @@ export const useKeyboardShortcuts = () => {
|
||||
if (matchedNewSessionShortcut || matchedWorktreeShortcut) {
|
||||
e.preventDefault();
|
||||
|
||||
setActiveSurface('chat');
|
||||
setSessionSwitcherOpen(false);
|
||||
|
||||
if (!isVSCodeRuntime() && matchedWorktreeShortcut) {
|
||||
@@ -394,11 +390,10 @@ export const useKeyboardShortcuts = () => {
|
||||
isHelpDialogOpen,
|
||||
isSessionSwitcherOpen,
|
||||
isAboutDialogOpen,
|
||||
activeSurface,
|
||||
} = useUIStore.getState();
|
||||
|
||||
const hasOverlay = isSettingsDialogOpen || isCommandPaletteOpen || isHelpDialogOpen || isSessionSwitcherOpen || isAboutDialogOpen;
|
||||
if (hasOverlay || activeSurface !== 'chat' || !isChatInputTarget(e.target)) {
|
||||
if (hasOverlay || !isChatInputTarget(e.target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -525,7 +520,6 @@ export const useKeyboardShortcuts = () => {
|
||||
isHelpDialogOpen,
|
||||
isSessionSwitcherOpen,
|
||||
isAboutDialogOpen,
|
||||
activeSurface,
|
||||
isModelSelectorOpen,
|
||||
} = useUIStore.getState();
|
||||
|
||||
@@ -536,7 +530,7 @@ export const useKeyboardShortcuts = () => {
|
||||
|
||||
// Skip if any overlay open or not on chat tab
|
||||
const hasOverlay = isCommandPaletteOpen || isHelpDialogOpen || isSessionSwitcherOpen || isAboutDialogOpen;
|
||||
const isChatActive = activeSurface === 'chat';
|
||||
const isChatActive = true;
|
||||
|
||||
if (hasOverlay || !isChatActive) {
|
||||
return;
|
||||
@@ -555,7 +549,6 @@ export const useKeyboardShortcuts = () => {
|
||||
isHelpDialogOpen,
|
||||
isSessionSwitcherOpen,
|
||||
isAboutDialogOpen,
|
||||
activeSurface,
|
||||
} = useUIStore.getState();
|
||||
|
||||
if (isSettingsDialogOpen) {
|
||||
@@ -563,7 +556,7 @@ export const useKeyboardShortcuts = () => {
|
||||
}
|
||||
|
||||
const hasOverlay = isCommandPaletteOpen || isHelpDialogOpen || isSessionSwitcherOpen || isAboutDialogOpen;
|
||||
const isChatActive = activeSurface === 'chat';
|
||||
const isChatActive = true;
|
||||
|
||||
if (hasOverlay || !isChatActive) {
|
||||
return;
|
||||
@@ -602,7 +595,6 @@ export const useKeyboardShortcuts = () => {
|
||||
isHelpDialogOpen,
|
||||
isSessionSwitcherOpen,
|
||||
isAboutDialogOpen,
|
||||
activeSurface,
|
||||
favoriteModels,
|
||||
addRecentModel,
|
||||
} = useUIStore.getState();
|
||||
@@ -612,7 +604,7 @@ export const useKeyboardShortcuts = () => {
|
||||
}
|
||||
|
||||
const hasOverlay = isCommandPaletteOpen || isHelpDialogOpen || isSessionSwitcherOpen || isAboutDialogOpen;
|
||||
const isChatActive = activeSurface === 'chat';
|
||||
const isChatActive = true;
|
||||
|
||||
if (hasOverlay || !isChatActive || favoriteModels.length === 0) {
|
||||
return;
|
||||
@@ -644,8 +636,8 @@ export const useKeyboardShortcuts = () => {
|
||||
}
|
||||
|
||||
if (eventMatchesShortcut(e, combo('toggle_dictation'))) {
|
||||
const { activeSurface, isCommandPaletteOpen, isHelpDialogOpen, isSessionSwitcherOpen, isSettingsDialogOpen } = useUIStore.getState();
|
||||
if (activeSurface !== 'chat' || isCommandPaletteOpen || isHelpDialogOpen || isSessionSwitcherOpen || isSettingsDialogOpen) {
|
||||
const { isCommandPaletteOpen, isHelpDialogOpen, isSessionSwitcherOpen, isSettingsDialogOpen } = useUIStore.getState();
|
||||
if (isCommandPaletteOpen || isHelpDialogOpen || isSessionSwitcherOpen || isSettingsDialogOpen) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
@@ -695,7 +687,6 @@ export const useKeyboardShortcuts = () => {
|
||||
toggleTerminalSurfaceExpanded,
|
||||
isMobile,
|
||||
setSessionSwitcherOpen,
|
||||
setActiveSurface,
|
||||
setSettingsDialogOpen,
|
||||
setModelSelectorOpen,
|
||||
setTimelineDialogOpen,
|
||||
|
||||
Reference in New Issue
Block a user