From 91ae87a8ee54af0a391e0ef86a118473724a01ca Mon Sep 17 00:00:00 2001 From: yu859 <15715093608@163.com> Date: Sat, 22 Aug 2026 11:48:14 +0800 Subject: [PATCH 1/2] fix(hub-ui): bind shortcuts to nested commands at any depth Every consumer of the command tree walked a single level of `children`, so anything deeper was unreachable: a dock group's members had no row in the shortcut settings to bind, no entry in the keybinding collector to fire, and no id the dispatcher could resolve. Traversal now lives in one place. `walkCommands` visits the tree depth-first with a `'skip'`/`'stop'` visitor signal, and `findCommandDeep`, `collectAllKeybindings`, the shortcut settings rows and the palette's root flatten all share it. `filterCommandsByWhen` keeps its own recursion since it rebuilds a cloned tree per level. The palette's flatten and drill-down stack move to `state/palette.ts`, where `showInPalette: 'without-children'` prunes a whole subtree rather than one level, and a row carries its full path for search while displaying only its immediate parent. Shortcut rows indent by nesting level instead of a boolean. --- .../command-palette/CommandPalette.vue | 85 ++++---- .../views-builtin/SettingsShortcuts.vue | 58 +++--- .../src/client/state/keybindings.test.ts | 191 ++++++++++++++++++ .../hub-ui/src/client/state/keybindings.ts | 96 ++++++--- .../hub-ui/src/client/state/palette.test.ts | 106 ++++++++++ packages/hub-ui/src/client/state/palette.ts | 81 ++++++++ 6 files changed, 532 insertions(+), 85 deletions(-) create mode 100644 packages/hub-ui/src/client/state/keybindings.test.ts create mode 100644 packages/hub-ui/src/client/state/palette.test.ts create mode 100644 packages/hub-ui/src/client/state/palette.ts diff --git a/packages/hub-ui/src/client/components/command-palette/CommandPalette.vue b/packages/hub-ui/src/client/components/command-palette/CommandPalette.vue index 1aba472c..6e5d1cd1 100644 --- a/packages/hub-ui/src/client/components/command-palette/CommandPalette.vue +++ b/packages/hub-ui/src/client/components/command-palette/CommandPalette.vue @@ -1,8 +1,10 @@