feat: Let mode changes trigger a re-render for Vue nodes (#5599)

* feat: Let mode changes trigger a re-render for Vue nodes

* Oops!
This commit is contained in:
Alexander Brown
2025-09-15 18:25:58 -07:00
committed by GitHub
parent b8d8193a38
commit 4f8e820c51
2 changed files with 26 additions and 14 deletions

View File

@@ -789,19 +789,27 @@ export const useGraphNodeManager = (graph: LGraph): GraphNodeManager => {
const currentData = vueNodeData.get(nodeId) const currentData = vueNodeData.get(nodeId)
if (currentData) { if (currentData) {
if (event.property === 'title') { switch (event.property) {
vueNodeData.set(nodeId, { case 'title':
...currentData, vueNodeData.set(nodeId, {
title: String(event.newValue) ...currentData,
}) title: String(event.newValue)
} else if (event.property === 'flags.collapsed') { })
vueNodeData.set(nodeId, { break
...currentData, case 'flags.collapsed':
flags: { vueNodeData.set(nodeId, {
...currentData.flags, ...currentData,
collapsed: Boolean(event.newValue) flags: {
} ...currentData.flags,
}) collapsed: Boolean(event.newValue)
}
})
break
case 'mode':
vueNodeData.set(nodeId, {
...currentData,
mode: typeof event.newValue === 'number' ? event.newValue : 0
})
} }
} }
} }

View File

@@ -3,7 +3,11 @@ import type { LGraphNode } from './LGraphNode'
/** /**
* Default properties to track * Default properties to track
*/ */
const DEFAULT_TRACKED_PROPERTIES: string[] = ['title', 'flags.collapsed'] const DEFAULT_TRACKED_PROPERTIES: string[] = [
'title',
'flags.collapsed',
'mode'
]
/** /**
* Manages node properties with optional change tracking and instrumentation. * Manages node properties with optional change tracking and instrumentation.