Skip to content

fix(hub-ui): keep transient-context commands listed in shortcut settings - #222

Merged
antfu merged 1 commit into
mainfrom
fix/settings-shortcuts-transient-context
Aug 14, 2026
Merged

fix(hub-ui): keep transient-context commands listed in shortcut settings#222
antfu merged 1 commit into
mainfrom
fix/settings-shortcuts-transient-context

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Context

Ports vitejs/devtools#524 ("fix(core): keep transient-context commands listed in shortcut settings") by @SaKaNa-Y to this fork's equivalent file after the v0.9 migration moved SettingsShortcuts.vue from packages/core/src/client/webcomponents/components/views-builtin/ (vitejs/devtools) to packages/hub-ui/src/client/components/views-builtin/ (here).

Problem

SettingsShortcuts.vue filtered the shortcut list with filterCommandsByWhen(commandsCtx.commands, props.context.when.context), evaluating each command's when clause against the live context. The Close Panel command's when: 'dockOpen && !paletteOpen' exists so Escape defers to the command palette while it's open — it doesn't mean Close Panel becomes unbindable. But because the settings page reads the live paletteOpen flag, opening the Command Palette (Ctrl+K) made Close Panel's when evaluate false and the row vanished from the shortcut settings list, then reappeared once the palette closed.

Fix

Pin the transient dispatch flags (dockOpen: true, paletteOpen: false) when filtering commands for this page, since it's only reachable with the dock open and the palette closed anyway. popupOpen and clientType stay live — those describe whether a command can exist at all (e.g. dock-mode commands still correctly disappear while the dock is detached into a popup).

Closes #210

Co-authored-by: SaKaNa-Y 15715093608@163.com


This PR was created with the help of an agent.

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>
@netlify

netlify Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit db6f02f
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a7eb075b3ebc30008191747
😎 Deploy Preview https://deploy-preview-222--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@antfu
antfu merged commit 50f20f8 into main Aug 14, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port fix from vitejs/devtools#524: keep transient-context commands listed in shortcut settings

2 participants