Comfy-Org / Comfy-Org/ComfyUI_frontend

[Bug]: Keybindings set in settings persist when command is removed

Open
#2,407 6 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

### Frontend Version

1.9.0

### Expected Behavior

Situations in which a keybind-mappable command is removed:

- Using an extension (custom node), then uninstall it or disable it
- Using the desktop app, then switch back to web version temporarily (shared settings)

When the command no longer exists, it should be possible to assign a new command to the key sequence.

### Actual Behavior

When the command is removed, the keybinding is not moved to unset. Since overwriting keybindings is not possible and there is no entry in the settings dialog to remove the keybinding, the key sequence can now no longer be mapped.

### Steps to Reproduce

1. Register an extension by pasting this into browser console:

```typescript
app.registerExtension({
name: 'TestExtension',
commands: [
{
id: 'TestCommand',
label: 'Test Command'
function: () => {
alert('TestCommand')
}
}
],
})
```

2. Open settings dialog
3. Go to Keybindings panel in settings
4. Assign a keybinding to the 'Test Command' at the bottom of the panel
5. Reload the page (simulating loading with the extension removed)
6. Press the key sequence, observe console error
7. Try to re-bind the key sequence, observe that it can't be overwritten
8. Try to unbind the key sequence, observe that it's not in settings

### Browser Logs

```
commandStore.ts:97 Uncaught (in promise) Error: Command TestCommand not found
at Proxy.execute (commandStore.ts:97:13)
at Proxy.wrappedAction (pinia.mjs:1405:26)
at store. (pinia.mjs:932:50)
at keybindHandler (keybindingService.ts:37:26)
```

### Setting JSON

[comfy.settings.json](https://github.com/user-attachments/files/18638295/comfy.settings.json)

### What browsers do you use to access the UI ?

Google Chrome

### Other

If the keybinding is set inside of the `registerExtension` call, this error does not occur.

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-2407-Bug-Keybindings-set-in-settings-persist-when-command-is-removed-18f6d73d365081b098d6faa1626101f6) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.