mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-14 01:36:14 +00:00
fix(keybindings): serialize KeybindingImpl to plain object before persisting
_.isEqual compares constructors, so KeybindingImpl instances are never equal to the plain objects returned by the backend. Serialize bindings to plain objects before passing to setMany so the deep-equality check in settingStore can correctly skip redundant writes.
This commit is contained in:
@@ -124,13 +124,25 @@ export function useKeybindingService() {
|
||||
}
|
||||
|
||||
async function persistUserKeybindings() {
|
||||
const toPlain = (b: KeybindingImpl) => ({
|
||||
commandId: b.commandId,
|
||||
combo: {
|
||||
key: b.combo.key,
|
||||
ctrl: b.combo.ctrl,
|
||||
alt: b.combo.alt,
|
||||
shift: b.combo.shift
|
||||
},
|
||||
...(b.targetElementId !== undefined && {
|
||||
targetElementId: b.targetElementId
|
||||
})
|
||||
})
|
||||
await settingStore.setMany({
|
||||
'Comfy.Keybinding.NewBindings': Object.values(
|
||||
keybindingStore.getUserKeybindings()
|
||||
),
|
||||
).map(toPlain),
|
||||
'Comfy.Keybinding.UnsetBindings': Object.values(
|
||||
keybindingStore.getUserUnsetKeybindings()
|
||||
)
|
||||
).map(toPlain)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user