[backport cloud/1.40] fix: prevent infinite node resize loop in Vue mode (#9179)

Backport of #9177 to `cloud/1.40`

Automatically created by backport workflow.

Co-authored-by: Alexander Brown <drjkl@comfy.org>
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Comfy Org PR Bot
2026-02-25 06:18:38 +09:00
committed by GitHub
parent c7cbefc256
commit 9ba3d75c5b
2 changed files with 12 additions and 3 deletions

View File

@@ -4187,7 +4187,12 @@ export class LGraphNode
// Ref: https://github.com/Comfy-Org/ComfyUI_frontend/issues/2652
// TODO: Move the layout logic before drawing of the node shape, so we don't
// need to trigger extra round of rendering.
if (y > bodyHeight) {
// In Vue mode, the DOM is the source of truth for node sizing — the
// ResizeObserver feeds measurements back to the layout store. Allowing
// LiteGraph to also call setSize() here creates an infinite feedback loop
// (LG grows node → CSS min-height increases → textarea fills extra space →
// ResizeObserver reports larger size → LG grows node again).
if (!LiteGraph.vueNodesMode && y > bodyHeight) {
this.setSize([this.size[0], y])
this.graph.setDirtyCanvas(false, true)
}

View File

@@ -50,8 +50,12 @@ export function useLayoutSync() {
liteNode.size[0] !== layout.size.width ||
liteNode.size[1] !== layout.size.height
) {
// Use setSize() to trigger onResize callback
liteNode.setSize([layout.size.width, layout.size.height])
// Update internal size directly (like position above) to avoid
// the size setter writing back to layoutStore with Canvas source,
// which would create a feedback loop through handleLayoutChange.
liteNode.size[0] = layout.size.width
liteNode.size[1] = layout.size.height
liteNode.onResize?.(liteNode.size)
}
}