mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
[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:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user