mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
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:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user