From cfbd5361d3bb26d60fd7773364458a2c4c92a3f2 Mon Sep 17 00:00:00 2001 From: AustinMroz Date: Wed, 12 Nov 2025 12:25:43 -0800 Subject: [PATCH] Fix subgraph conversion of primitives (#6606) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ![AnimateDiff_00001](https://github.com/user-attachments/assets/a40db1c7-5f0e-43b2-a7fc-a324188a3930) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6606-Fix-subgraph-conversion-of-primitives-2a36d73d3650818e9e74dd383a7f9007) by [Unito](https://www.unito.io) --- src/extensions/core/widgetInputs.ts | 4 +--- src/lib/litegraph/src/LGraph.ts | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extensions/core/widgetInputs.ts b/src/extensions/core/widgetInputs.ts index 85054aba5..62f1244b7 100644 --- a/src/extensions/core/widgetInputs.ts +++ b/src/extensions/core/widgetInputs.ts @@ -168,16 +168,14 @@ export class PrimitiveNode extends LGraphNode { #onFirstConnection(recreating?: boolean) { // First connection can fire before the graph is ready on initial load so random things can be missing - if (!this.outputs[0].links) { + if (!this.outputs[0].links || !this.graph) { this.onLastDisconnect() return } const linkId = this.outputs[0].links[0] - // @ts-expect-error fixme ts strict error const link = this.graph.links[linkId] if (!link) return - // @ts-expect-error fixme ts strict error const theirNode = this.graph.getNodeById(link.target_id) if (!theirNode || !theirNode.inputs) return diff --git a/src/lib/litegraph/src/LGraph.ts b/src/lib/litegraph/src/LGraph.ts index 3a5ce49f4..4678576a5 100644 --- a/src/lib/litegraph/src/LGraph.ts +++ b/src/lib/litegraph/src/LGraph.ts @@ -1566,6 +1566,8 @@ export class LGraph const subgraph = this.createSubgraph(data) subgraph.configure(data) + for (const node of subgraph.nodes) node.onGraphConfigured?.() + for (const node of subgraph.nodes) node.onAfterGraphConfigured?.() // Position the subgraph input nodes subgraph.inputNode.arrange()