Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
christian-byrne committed Aug 18, 2025
commit 555d43c8dc1ae5610d0a6aeaf093c88e589efbe3
25 changes: 25 additions & 0 deletions src/components/graph/GraphCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Comment on lines +764 to +765
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace later when graph mutations are made reactive.

// 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()
Expand Down