Only update domWidgetStore if graph is active

This commit is contained in:
Austin Mroz
2025-09-25 10:51:04 -05:00
parent 3efb76b765
commit 0de4351913

View File

@@ -45,11 +45,17 @@ export function registerProxyWidgets(canvas: LGraphCanvas) {
set: (property: string) => {
const parsed = parseProxyWidgets(property)
const { widgetStates } = useDomWidgetStore()
for (const w of subgraphNode.widgets.filter((w) => isProxyWidget(w))) {
if (w instanceof DOMWidgetImpl && widgetStates.has(w.id)) {
const widgetState = widgetStates.get(w.id)
if (!widgetState) continue
widgetState.active = false
const isActiveGraph =
useCanvasStore().canvas?.graph === subgraphNode.graph
if (isActiveGraph) {
for (const w of subgraphNode.widgets.filter((w) =>
isProxyWidget(w)
)) {
if (w instanceof DOMWidgetImpl && widgetStates.has(w.id)) {
const widgetState = widgetStates.get(w.id)
if (!widgetState) continue
widgetState.active = false
}
}
}
//NOTE: This does not apply to pushed entries, only initial load
@@ -58,7 +64,7 @@ export function registerProxyWidgets(canvas: LGraphCanvas) {
)
for (const [nodeId, widgetName] of parsed) {
const w = addProxyWidget(subgraphNode, `${nodeId}`, widgetName)
if (w instanceof DOMWidgetImpl) {
if (isActiveGraph && w instanceof DOMWidgetImpl) {
const widgetState = widgetStates.get(w.id)
if (!widgetState) continue
widgetState.active = true