fix: force arrange() on Vue-to-legacy switch to prevent link header fallback

When switching from Vue to legacy mode, drawConnections (background
canvas) can run before drawNode (foreground canvas) in the same frame,
leaving input.pos unset and causing links to fall back to the node
header.  Force arrange() on all nodes immediately before setDirty so
slot positions are ready for the first legacy render pass.
This commit is contained in:
jaeone94
2026-03-23 21:26:46 +09:00
parent 0c062c24c7
commit e785488fa7

View File

@@ -86,6 +86,21 @@ function useVueNodeLifecycleIndividual() {
() => !shouldRenderVueNodes.value,
() => {
disposeNodeManagerAndSyncs()
// Force arrange() on all nodes so input.pos is computed before
// the first legacy drawConnections frame (which may run before
// drawNode on the foreground canvas).
const graph = comfyApp.canvas?.graph
if (graph) {
for (const node of graph._nodes) {
try {
if (!node.flags.collapsed) node.arrange()
} catch {
/* skip nodes not fully initialized */
}
}
}
comfyApp.canvas?.setDirty(true, true)
}
)