From af1a5d9dbc5f606e0813235003f82493b0ff06a8 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 27 Dec 2024 22:42:41 -0500 Subject: [PATCH] Fix Comfy.WidgetControlMode watcher (#2079) --- src/components/graph/GraphCanvas.vue | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index 700232f982..cdc7734ed8 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -196,22 +196,27 @@ watchEffect(() => { LiteGraph.alwaysSnapToGrid = settingStore.get('pysssss.SnapToGrid') }) -watch(settingStore.get('Comfy.WidgetControlMode'), () => { - for (const n of comfyApp.graph.nodes) { - if (!n.widgets) continue - for (const w of n.widgets) { - if (w[IS_CONTROL_WIDGET]) { - updateControlWidgetLabel(w) - if (w.linkedWidgets) { - for (const l of w.linkedWidgets) { - updateControlWidgetLabel(l) +watch( + () => settingStore.get('Comfy.WidgetControlMode'), + () => { + if (!canvasStore.canvas) return + + for (const n of comfyApp.graph.nodes) { + if (!n.widgets) continue + for (const w of n.widgets) { + if (w[IS_CONTROL_WIDGET]) { + updateControlWidgetLabel(w) + if (w.linkedWidgets) { + for (const l of w.linkedWidgets) { + updateControlWidgetLabel(l) + } } } } } + comfyApp.graph.setDirtyCanvas(true) } - comfyApp.graph.setDirtyCanvas(true) -}) +) watchEffect(() => { if (!canvasStore.canvas) return