From 348046ec911046aa9a67744c4f3ee387cc7d28e5 Mon Sep 17 00:00:00 2001 From: AustinMroz Date: Sat, 6 Sep 2025 02:15:54 -0700 Subject: [PATCH] When converting single group to subgraph, also convert children (#5217) * On conversion of single group, convert children If convert to subgraph is called on a selection consisting of a single group, the groups children are also converted to subgraph. * Update locales [skip ci] * Create new set to avoid mutating passed argument --------- Co-authored-by: github-actions --- src/lib/litegraph/src/LGraph.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/litegraph/src/LGraph.ts b/src/lib/litegraph/src/LGraph.ts index cdd387d89..17b7f6c17 100644 --- a/src/lib/litegraph/src/LGraph.ts +++ b/src/lib/litegraph/src/LGraph.ts @@ -1482,6 +1482,12 @@ export class LGraph if (items.size === 0) throw new Error('Cannot convert to subgraph: nothing to convert') const { state, revision, config } = this + const firstChild = [...items][0] + if (items.size === 1 && firstChild instanceof LGraphGroup) { + items = new Set([firstChild]) + firstChild.recomputeInsideNodes() + firstChild.children.forEach((n) => items.add(n)) + } const { boundaryLinks,