mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 19:21:54 +00:00
Replace unset unknown keybinding error with warn (#2186)
This commit is contained in:
@@ -227,7 +227,7 @@ export const useKeybindingStore = defineStore('keybinding', () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Unknown keybinding: ${JSON.stringify(keybinding)}`)
|
console.warn(`Unset unknown keybinding: ${JSON.stringify(keybinding)}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -149,6 +149,24 @@ describe('useKeybindingStore', () => {
|
|||||||
expect(() => store.unsetKeybinding(keybinding)).not.toThrow()
|
expect(() => store.unsetKeybinding(keybinding)).not.toThrow()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should not throw an error when unsetting unknown keybinding', () => {
|
||||||
|
const store = useKeybindingStore()
|
||||||
|
const keybinding = new KeybindingImpl({
|
||||||
|
commandId: 'test.command',
|
||||||
|
combo: { key: 'I', ctrl: true }
|
||||||
|
})
|
||||||
|
store.addUserKeybinding(keybinding)
|
||||||
|
|
||||||
|
expect(() =>
|
||||||
|
store.unsetKeybinding(
|
||||||
|
new KeybindingImpl({
|
||||||
|
commandId: 'test.foo',
|
||||||
|
combo: { key: 'I', ctrl: true }
|
||||||
|
})
|
||||||
|
)
|
||||||
|
).not.toThrow()
|
||||||
|
})
|
||||||
|
|
||||||
it('should remove unset keybinding when adding back a default keybinding', () => {
|
it('should remove unset keybinding when adding back a default keybinding', () => {
|
||||||
const store = useKeybindingStore()
|
const store = useKeybindingStore()
|
||||||
const defaultKeybinding = new KeybindingImpl({
|
const defaultKeybinding = new KeybindingImpl({
|
||||||
|
|||||||
Reference in New Issue
Block a user