From db6f02ff01c79eb28ca5ae88c52e4613ec0bc150 Mon Sep 17 00:00:00 2001 From: Anthony Bot Date: Fri, 14 Aug 2026 06:06:00 +0000 Subject: [PATCH] fix(hub-ui): keep transient-context commands listed in shortcut settings Pin `dockOpen`/`paletteOpen` when filtering commands for the shortcut settings list, instead of evaluating `when` against the live context. Those two flags are transient dispatch state (close-panel's `!paletteOpen` exists to hand Escape to the palette, not to mark the command unbindable), so filtering by their live values dropped permanently bindable rows like Close Panel the moment the command palette opened. Ports vitejs/devtools#524 by @SaKaNa-Y to this fork's equivalent file after the v0.9 migration. Co-authored-by: SaKaNa-Y <15715093608@163.com> --- .../views-builtin/SettingsShortcuts.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/hub-ui/src/client/components/views-builtin/SettingsShortcuts.vue b/packages/hub-ui/src/client/components/views-builtin/SettingsShortcuts.vue index e835fdb0..90eec01b 100644 --- a/packages/hub-ui/src/client/components/views-builtin/SettingsShortcuts.vue +++ b/packages/hub-ui/src/client/components/views-builtin/SettingsShortcuts.vue @@ -22,10 +22,17 @@ interface ShortcutRow { indent: boolean } -// Only offer to bind commands that are actually reachable right now — binding a -// key to something the current context rules out (e.g. the dock-mode commands -// while the dock is detached into a popup) would silently do nothing. -const availableCommands = computed(() => filterCommandsByWhen(commandsCtx.commands, props.context.when.context)) +// This page is only reachable with the dock open and the palette closed, so `when` +// is evaluated against that context rather than the live one. `dockOpen`/`paletteOpen` +// are transient dispatch state — `close-panel`'s `!paletteOpen` exists to hand Escape +// to the palette, not to say the command is unbindable — so filtering by them would +// drop permanently bindable rows the moment Ctrl+K is pressed. `popupOpen` and +// `clientType` stay live: those describe whether a command can exist at all, which is +// why the dock-mode commands still vanish while the dock is detached into a popup. +const availableCommands = computed(() => filterCommandsByWhen( + commandsCtx.commands, + { ...props.context.when.context, dockOpen: true, paletteOpen: false }, +)) const shortcutRows = computed(() => { const rows: ShortcutRow[] = []