Fix inconsistent subgraphNode usage

Prior to this commit, subgraphNode inconsistently refers to either the
parent graph, or to indicate the current node is a subgraph.

This corrects the usage of subgraphNode to consistently refer to the
subgraph instance as defined in the constructor.

This solves a bug where graph serialization fails due to an incorrectly
reported infinite loop.

Port of https://github.com/Comfy-Org/litegraph.js/pull/1193
This commit is contained in:
Benjamin Lu
2025-08-05 18:29:05 -04:00
parent 01e4260d4c
commit 85a5d1ed56

View File

@@ -126,11 +126,8 @@ export class ExecutableNodeDTO implements ExecutableLGraphNode {
/** Returns either the DTO itself, or the DTOs of the inner nodes of the subgraph. */
getInnerNodes(): ExecutableLGraphNode[] {
return this.subgraphNode
? this.subgraphNode.getInnerNodes(
this.nodesByExecutionId,
this.subgraphNodePath
)
return this.node.isSubgraphNode()
? this.node.getInnerNodes(this.nodesByExecutionId, this.subgraphNodePath)
: [this]
}