Fix widgets added after previews on subgraph nodes (#5084)

Image previews are displayed on nodes as a widget. If a new input is
added to a subgraph that already has an image preview, that widget is
incorrectly placed after the preview. This is fixed by instead counting
the number of existing inputs that are already linked to widgets.
This commit is contained in:
AustinMroz
2025-08-18 18:25:39 -05:00
committed by GitHub
parent ba4c159ce5
commit 75d7a3725b

View File

@@ -361,7 +361,8 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
}
})
this.widgets.push(promotedWidget)
const widgetCount = this.inputs.filter((i) => i.widget).length
this.widgets.splice(widgetCount, 0, promotedWidget)
// Dispatch widget-promoted event
this.subgraph.events.dispatch('widget-promoted', {