From 017a1dc4298db58a48ab4103e6a96b332884e60c Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 9 Sep 2025 19:58:23 -0700 Subject: [PATCH] get node via current graph --- .../vueNodes/components/LGraphNode.vue | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/renderer/extensions/vueNodes/components/LGraphNode.vue b/src/renderer/extensions/vueNodes/components/LGraphNode.vue index 7d370d5c9..975fb76d0 100644 --- a/src/renderer/extensions/vueNodes/components/LGraphNode.vue +++ b/src/renderer/extensions/vueNodes/components/LGraphNode.vue @@ -161,7 +161,6 @@ import { ExecutedWsMessage } from '@/schemas/apiSchema' import { app } from '@/scripts/app' import { useExecutionStore } from '@/stores/executionStore' import { useNodeOutputStore } from '@/stores/imagePreviewStore' -import { getNodeByLocatorId } from '@/utils/graphTraversalUtil' import { cn } from '@/utils/tailwindUtil' import { useVueElementTracking } from '../composables/useVueNodeResizeTracking' @@ -404,19 +403,9 @@ const nodeOutputs = useNodeOutputStore() const nodeImageUrls = ref([]) const onNodeOutputsUpdate = (newOutputs: ExecutedWsMessage['output']) => { - // Construct proper locator ID using subgraph ID from VueNodeData - const locatorId = nodeData.subgraphId - ? `${nodeData.subgraphId}:${nodeData.id}` - : nodeData.id - - // Use root graph for getNodeByLocatorId since it needs to traverse from root - const rootGraph = app.graph?.rootGraph || app.graph - if (!rootGraph) { - nodeImageUrls.value = [] - return - } - - const node = getNodeByLocatorId(rootGraph, locatorId) + // Get the current graph context (subgraph if viewing one, otherwise root graph) + const currentGraph = app.canvas.graph || app.graph + const node = currentGraph?.getNodeById(Number(nodeData.id)) if (node && newOutputs?.images?.length) { const urls = nodeOutputs.getNodeImageUrls(node) if (urls) { @@ -442,4 +431,8 @@ watch( // Provide nodeImageUrls to child components provide('nodeImageUrls', nodeImageUrls) +provide( + 'nodeId', + computed(() => String(nodeData.id)) +)