From 555d43c8dc1ae5610d0a6aeaf093c88e589efbe3 Mon Sep 17 00:00:00 2001 From: bymyself Date: Mon, 18 Aug 2025 15:51:03 -0700 Subject: [PATCH 1/2] fix: Initialize Vue node manager when first node is added to empty graph When Vue nodes are enabled and the graph starts empty (0 nodes), the node manager wasn't being initialized. This caused Vue nodes to not render until the setting was toggled off and on again. The fix adds a one-time event handler that listens for the first node being added to an empty graph and initializes the node manager at that point. Fixes the issue where Vue nodes don't render on initial page load when the setting is enabled. --- src/components/graph/GraphCanvas.vue | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index b49d501cdc..924a8cffd3 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -752,6 +752,31 @@ onMounted(async () => { comfyAppReady.value = true + // Set up a one-time listener for when the first node is added + // This handles the case where Vue nodes are enabled but the graph starts empty + if ( + transformPaneEnabled.value && + comfyApp.graph && + !nodeManager && + comfyApp.graph._nodes.length === 0 + ) { + const originalOnNodeAdded = comfyApp.graph.onNodeAdded + comfyApp.graph.onNodeAdded = function (node: any) { + // Restore original handler + comfyApp.graph.onNodeAdded = originalOnNodeAdded + + // Initialize node manager if needed + if (transformPaneEnabled.value && !nodeManager) { + initializeNodeManager() + } + + // Call original handler + if (originalOnNodeAdded) { + originalOnNodeAdded.call(this, node) + } + } + } + comfyApp.canvas.onSelectionChange = useChainCallback( comfyApp.canvas.onSelectionChange, () => canvasStore.updateSelectedItems() From ef1432d3faa770a94788ad0ae76b5b7c07ef6700 Mon Sep 17 00:00:00 2001 From: bymyself Date: Mon, 18 Aug 2025 16:45:00 -0700 Subject: [PATCH 2/2] fix: Add TODO comment for reactive graph mutations observer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added comment to indicate that the monkey-patching approach should be replaced with a proper reactive graph mutations observer when available. 🤖 Generated with Claude Code Co-Authored-By: Claude --- src/components/graph/GraphCanvas.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index 924a8cffd3..f972b8aa35 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -754,6 +754,7 @@ onMounted(async () => { // Set up a one-time listener for when the first node is added // This handles the case where Vue nodes are enabled but the graph starts empty + // TODO: Replace this with a reactive graph mutations observer when available if ( transformPaneEnabled.value && comfyApp.graph &&