From a433e69205f32e98135b62b36c8adf0e725e66c3 Mon Sep 17 00:00:00 2001 From: jaeone94 <89377375+jaeone94@users.noreply.github.com> Date: Sat, 10 Oct 2026 12:21:38 +0900 Subject: [PATCH 1/3] fix: disconnect orphaned DynamicGroup host inputs --- .../graph/widgets/dynamicGroupWidget.test.ts | 68 ++++++++++++++++++- src/core/graph/widgets/dynamicGroupWidget.ts | 5 +- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/core/graph/widgets/dynamicGroupWidget.test.ts b/src/core/graph/widgets/dynamicGroupWidget.test.ts index 7a0fd1417da..885daf63a5f 100644 --- a/src/core/graph/widgets/dynamicGroupWidget.test.ts +++ b/src/core/graph/widgets/dynamicGroupWidget.test.ts @@ -379,7 +379,7 @@ describe('DynamicGroup widgets', () => { ).toBe(true) const outerInput = outerHost.inputs[0] expect(promotedInputWidget(outerInput)?.label).toBe('LoRA #2 strength') - return { widget, innerHost, outerHost, outerSubgraph, outerInput } + return { node, widget, innerHost, outerHost, outerSubgraph, outerInput } } it.for([ @@ -472,6 +472,72 @@ describe('DynamicGroup widgets', () => { await vi.waitFor(() => expect(promotedInputWidget(outerInput)).toBeNull()) }) + it('disconnects the deleted row at the outer host while keeping the next row connected', async () => { + const { node, widget, innerHost, outerHost, outerInput } = + setupTwiceDeepPromotion() + const graph = innerHost.subgraph.rootGraph + widget('loras').value = 3 + widget('loras.2.lora_name').value = 'C' + widget('loras.2.strength').value = 0.37 + expect( + promoteValueWidgetViaSubgraphInput( + innerHost, + node, + widget('loras.2.strength') + ).ok + ).toBe(true) + const innerPromoted = promotedInputWidget(innerHost.inputs[1]) + assert.exists(innerPromoted) + expect( + promoteValueWidgetViaSubgraphInput(outerHost, innerHost, innerPromoted).ok + ).toBe(true) + const survivingInput = outerHost.inputs[1] + const source = new LGraphNode('Strength source') + source.addOutput('strength', 'FLOAT') + graph.add(source) + const removed = source.connect(0, outerHost, 0) + const retained = source.connect(0, outerHost, 1) + assert.exists(removed) + assert.exists(retained) + + widget('loras.1').callback?.(undefined) + + await vi.waitFor(() => expect(promotedInputWidget(outerInput)).toBeNull()) + expect(graph.getLink(removed.id)).toBeUndefined() + expect(outerInput.link).toBeNull() + assert.exists(survivingInput.link) + expect(graph.getLink(survivingInput.link)).toBe(retained) + expect(promotedInputWidget(survivingInput)?.value).toBe(0.37) + expect(promotedInputWidget(survivingInput)?.label).toBe('LoRA #2 strength') + expect(widget('loras.1.lora_name').value).toBe('C') + expect(widget('loras.1.strength').value).toBe(0.37) + }) + + it('keeps the outer connection when another node still consumes the promoted input', () => { + const { widget, innerHost, outerHost, outerInput } = + setupTwiceDeepPromotion() + const graph = innerHost.subgraph.rootGraph + const other = new LGraphNode('Another strength consumer') + const input = other.addInput('strength', 'FLOAT') + innerHost.subgraph.add(other) + const internal = innerHost.subgraph.inputNode.slots[0].connect(input, other) + const source = new LGraphNode('Strength source') + source.addOutput('strength', 'FLOAT') + graph.add(source) + const external = source.connect(0, outerHost, 0) + assert.exists(internal) + assert.exists(external) + + widget('loras.1').callback?.(undefined) + + assert.exists(outerInput.link) + assert.exists(input.link) + expect(graph.getLink(outerInput.link)).toBe(external) + expect(innerHost.subgraph.getLink(input.link)).toBe(internal) + expect(innerHost.subgraph.inputs[0].linkIds).toEqual([internal.id]) + expect(widget('loras').value).toBe(1) + }) + it.for([ { label: 'LoRA #2 strength', expected: 'LoRA 1행 strength' }, { label: 'My strength', expected: 'My strength' } diff --git a/src/core/graph/widgets/dynamicGroupWidget.ts b/src/core/graph/widgets/dynamicGroupWidget.ts index afe7ab3a221..46a34295646 100644 --- a/src/core/graph/widgets/dynamicGroupWidget.ts +++ b/src/core/graph/widgets/dynamicGroupWidget.ts @@ -418,9 +418,10 @@ function disconnectOrphanedPromotion( if (!isSubgraph(graph) || graph.inputs[slot]?.linkIds.length) return for (const host of hosts(graph)) { const link = host.graph && inputLink(host.graph, host.id, slot) - if (link?.origin_id !== SUBGRAPH_INPUT_ID) continue + if (!link) continue host.disconnectInput(slot) - disconnectOrphanedPromotion(host.graph, link.origin_slot, hosts) + if (link.origin_id === SUBGRAPH_INPUT_ID) + disconnectOrphanedPromotion(host.graph, link.origin_slot, hosts) } } From cda28cd3cfdcac9609d7d13aa8981fff7d1c98f5 Mon Sep 17 00:00:00 2001 From: jaeone94 <89377375+jaeone94@users.noreply.github.com> Date: Sat, 10 Oct 2026 13:45:07 +0900 Subject: [PATCH 2/3] test: cover orphaned wires on multiple subgraph hosts --- src/core/graph/widgets/dynamicGroupWidget.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/graph/widgets/dynamicGroupWidget.test.ts b/src/core/graph/widgets/dynamicGroupWidget.test.ts index 885daf63a5f..a2e268f27b4 100644 --- a/src/core/graph/widgets/dynamicGroupWidget.test.ts +++ b/src/core/graph/widgets/dynamicGroupWidget.test.ts @@ -492,19 +492,29 @@ describe('DynamicGroup widgets', () => { promoteValueWidgetViaSubgraphInput(outerHost, innerHost, innerPromoted).ok ).toBe(true) const survivingInput = outerHost.inputs[1] + const otherHost = createTestSubgraphNode(outerHost.subgraph) + graph.add(otherHost) const source = new LGraphNode('Strength source') source.addOutput('strength', 'FLOAT') graph.add(source) const removed = source.connect(0, outerHost, 0) + const otherRemoved = source.connect(0, otherHost, 0) const retained = source.connect(0, outerHost, 1) assert.exists(removed) + assert.exists(otherRemoved) assert.exists(retained) + const before = vi.spyOn(innerHost.subgraph, 'beforeChange') + const after = vi.spyOn(innerHost.subgraph, 'afterChange') widget('loras.1').callback?.(undefined) await vi.waitFor(() => expect(promotedInputWidget(outerInput)).toBeNull()) expect(graph.getLink(removed.id)).toBeUndefined() + expect(graph.getLink(otherRemoved.id)).toBeUndefined() expect(outerInput.link).toBeNull() + expect(otherHost.inputs[0].link).toBeNull() + expect(before).toHaveBeenCalledOnce() + expect(after).toHaveBeenCalledOnce() assert.exists(survivingInput.link) expect(graph.getLink(survivingInput.link)).toBe(retained) expect(promotedInputWidget(survivingInput)?.value).toBe(0.37) From 78082cdf147c46a6c7145aeabb03da30fc83ce83 Mon Sep 17 00:00:00 2001 From: jaeone94 <89377375+jaeone94@users.noreply.github.com> Date: Sat, 10 Oct 2026 14:08:29 +0900 Subject: [PATCH 3/3] test: assert orphaned row outcomes without hook counts --- src/core/graph/widgets/dynamicGroupWidget.test.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/core/graph/widgets/dynamicGroupWidget.test.ts b/src/core/graph/widgets/dynamicGroupWidget.test.ts index a2e268f27b4..fec0992e797 100644 --- a/src/core/graph/widgets/dynamicGroupWidget.test.ts +++ b/src/core/graph/widgets/dynamicGroupWidget.test.ts @@ -503,8 +503,6 @@ describe('DynamicGroup widgets', () => { assert.exists(removed) assert.exists(otherRemoved) assert.exists(retained) - const before = vi.spyOn(innerHost.subgraph, 'beforeChange') - const after = vi.spyOn(innerHost.subgraph, 'afterChange') widget('loras.1').callback?.(undefined) @@ -513,8 +511,6 @@ describe('DynamicGroup widgets', () => { expect(graph.getLink(otherRemoved.id)).toBeUndefined() expect(outerInput.link).toBeNull() expect(otherHost.inputs[0].link).toBeNull() - expect(before).toHaveBeenCalledOnce() - expect(after).toHaveBeenCalledOnce() assert.exists(survivingInput.link) expect(graph.getLink(survivingInput.link)).toBe(retained) expect(promotedInputWidget(survivingInput)?.value).toBe(0.37)