Skip to content

Commit 50f20f8

Browse files
antfubotSaKaNa-Y
andauthored
fix(hub-ui): keep transient-context commands listed in shortcut settings (#222)
Co-authored-by: SaKaNa-Y <15715093608@163.com>
1 parent b117bf6 commit 50f20f8

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

packages/hub-ui/src/client/components/views-builtin/SettingsShortcuts.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,17 @@ interface ShortcutRow {
2222
indent: boolean
2323
}
2424
25-
// Only offer to bind commands that are actually reachable right now — binding a
26-
// key to something the current context rules out (e.g. the dock-mode commands
27-
// while the dock is detached into a popup) would silently do nothing.
28-
const availableCommands = computed(() => filterCommandsByWhen(commandsCtx.commands, props.context.when.context))
25+
// This page is only reachable with the dock open and the palette closed, so `when`
26+
// is evaluated against that context rather than the live one. `dockOpen`/`paletteOpen`
27+
// are transient dispatch state — `close-panel`'s `!paletteOpen` exists to hand Escape
28+
// to the palette, not to say the command is unbindable — so filtering by them would
29+
// drop permanently bindable rows the moment Ctrl+K is pressed. `popupOpen` and
30+
// `clientType` stay live: those describe whether a command can exist at all, which is
31+
// why the dock-mode commands still vanish while the dock is detached into a popup.
32+
const availableCommands = computed(() => filterCommandsByWhen(
33+
commandsCtx.commands,
34+
{ ...props.context.when.context, dockOpen: true, paletteOpen: false },
35+
))
2936
3037
const shortcutRows = computed<ShortcutRow[]>(() => {
3138
const rows: ShortcutRow[] = []

0 commit comments

Comments
 (0)