From 63fff48ce6fa3a2fadb5d63f19d2cb6ea5df72ca Mon Sep 17 00:00:00 2001 From: Kelly Yang <124ykl@gmail.com> Date: Tue, 5 May 2026 14:24:27 -0700 Subject: [PATCH] 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. --- src/platform/keybindings/keybindingService.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/platform/keybindings/keybindingService.ts b/src/platform/keybindings/keybindingService.ts index b11d6831a7..30ba4075f8 100644 --- a/src/platform/keybindings/keybindingService.ts +++ b/src/platform/keybindings/keybindingService.ts @@ -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) }) }