From 3ee6d534234f280d8679fab64a5e220225a8b470 Mon Sep 17 00:00:00 2001 From: AustinMroz Date: Mon, 15 Dec 2025 20:50:47 -0800 Subject: [PATCH] Make node inputs reactive in vue (#7546) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Piecemeal fix pulled out from #7095 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7546-Make-node-inputs-reactive-in-vue-2cb6d73d36508189a88bf35e5747b870) by [Unito](https://www.unito.io) --- src/composables/graph/useGraphNodeManager.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/composables/graph/useGraphNodeManager.ts b/src/composables/graph/useGraphNodeManager.ts index a1e3b9447..3aa812607 100644 --- a/src/composables/graph/useGraphNodeManager.ts +++ b/src/composables/graph/useGraphNodeManager.ts @@ -218,6 +218,15 @@ export function useGraphNodeManager(graph: LGraph): GraphNodeManager { reactiveWidgets.splice(0, reactiveWidgets.length, ...v) } }) + const reactiveInputs = shallowReactive(node.inputs ?? []) + Object.defineProperty(node, 'inputs', { + get() { + return reactiveInputs + }, + set(v) { + reactiveInputs.splice(0, reactiveInputs.length, ...v) + } + }) const safeWidgets = reactiveComputed(() => { node.inputs?.forEach((input, index) => { @@ -252,7 +261,7 @@ export function useGraphNodeManager(graph: LGraph): GraphNodeManager { badges, hasErrors: !!node.has_errors, widgets: safeWidgets, - inputs: node.inputs ? [...node.inputs] : undefined, + inputs: reactiveInputs, outputs: node.outputs ? [...node.outputs] : undefined, flags: node.flags ? { ...node.flags } : undefined, color: node.color || undefined,