fix: include disambiguatingSourceNodeId in instance widget key

The per-instance key must include disambiguatingSourceNodeId to
avoid collisions when multiple promoted widgets share the same
sourceNodeId and sourceWidgetName (e.g. nested subgraph promotions).
This commit is contained in:
dante01yoon
2026-04-04 23:33:43 +09:00
parent 731967c79d
commit b5138cb800
2 changed files with 13 additions and 6 deletions

View File

@@ -149,12 +149,18 @@ class PromotedWidgetView implements IPromotedWidgetView {
return this.resolveDeepest()?.widget.linkedWidgets
}
private get _instanceKey(): string {
return this.disambiguatingSourceNodeId
? `${this.sourceNodeId}:${this.sourceWidgetName}:${this.disambiguatingSourceNodeId}`
: `${this.sourceNodeId}:${this.sourceWidgetName}`
}
get value(): IBaseWidget['value'] {
// Check per-instance values first (populated during configure for
// multi-instance subgraphs sharing the same blueprint).
const instanceKey = `${this.sourceNodeId}:${this.sourceWidgetName}`
const instanceValue =
this.subgraphNode._instanceWidgetValues.get(instanceKey)
const instanceValue = this.subgraphNode._instanceWidgetValues.get(
this._instanceKey
)
if (instanceValue !== undefined)
return instanceValue as IBaseWidget['value']
@@ -165,8 +171,7 @@ class PromotedWidgetView implements IPromotedWidgetView {
set value(value: IBaseWidget['value']) {
// Store per-instance value to avoid overwriting shared inner node state
const instanceKey = `${this.sourceNodeId}:${this.sourceWidgetName}`
this.subgraphNode._instanceWidgetValues.set(instanceKey, value)
this.subgraphNode._instanceWidgetValues.set(this._instanceKey, value)
const linkedWidgets = this.getLinkedInputWidgets()
if (linkedWidgets.length > 0) {

View File

@@ -1146,7 +1146,9 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
let i = 0
for (const view of views) {
if (i >= this._pendingWidgetsValues.length) break
const key = `${view.sourceNodeId}:${view.sourceWidgetName}`
const key = view.disambiguatingSourceNodeId
? `${view.sourceNodeId}:${view.sourceWidgetName}:${view.disambiguatingSourceNodeId}`
: `${view.sourceNodeId}:${view.sourceWidgetName}`
this._instanceWidgetValues.set(key, this._pendingWidgetsValues[i++])
}
this._pendingWidgetsValues = undefined