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) => { set: (property: string) => {
const parsed = parseProxyWidgets(property) const parsed = parseProxyWidgets(property)
const { widgetStates } = useDomWidgetStore() const { widgetStates } = useDomWidgetStore()
for (const w of subgraphNode.widgets.filter((w) => isProxyWidget(w))) { const isActiveGraph =
if (w instanceof DOMWidgetImpl && widgetStates.has(w.id)) { useCanvasStore().canvas?.graph === subgraphNode.graph
const widgetState = widgetStates.get(w.id) if (isActiveGraph) {
if (!widgetState) continue for (const w of subgraphNode.widgets.filter((w) =>
widgetState.active = false 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 //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) { for (const [nodeId, widgetName] of parsed) {
const w = addProxyWidget(subgraphNode, `${nodeId}`, widgetName) const w = addProxyWidget(subgraphNode, `${nodeId}`, widgetName)
if (w instanceof DOMWidgetImpl) { if (isActiveGraph && w instanceof DOMWidgetImpl) {
const widgetState = widgetStates.get(w.id) const widgetState = widgetStates.get(w.id)
if (!widgetState) continue if (!widgetState) continue
widgetState.active = true widgetState.active = true