From e34d9bb4119d6d78a08ef40112e04dc9be801e4d Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Thu, 24 Jul 2025 07:58:50 +1000 Subject: [PATCH] Fix LoadImage bleeds values between subgraphs (#4507) --- src/composables/widgets/useImageUploadWidget.ts | 6 ++++-- src/stores/imagePreviewStore.ts | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/composables/widgets/useImageUploadWidget.ts b/src/composables/widgets/useImageUploadWidget.ts index 137b2f42c..355b83ca9 100644 --- a/src/composables/widgets/useImageUploadWidget.ts +++ b/src/composables/widgets/useImageUploadWidget.ts @@ -100,7 +100,8 @@ export const useImageUploadWidget = () => { // Add our own callback to the combo widget to render an image when it changes fileComboWidget.callback = function () { nodeOutputStore.setNodeOutputs(node, fileComboWidget.value, { - isAnimated + isAnimated, + isInitialLoad: true }) node.graph?.setDirtyCanvas(true) } @@ -110,7 +111,8 @@ export const useImageUploadWidget = () => { // No change callbacks seem to be fired on initial setting of the value requestAnimationFrame(() => { nodeOutputStore.setNodeOutputs(node, fileComboWidget.value, { - isAnimated + isAnimated, + isInitialLoad: true }) showPreview({ block: false }) }) diff --git a/src/stores/imagePreviewStore.ts b/src/stores/imagePreviewStore.ts index fb6c52cfa..b14a34b9a 100644 --- a/src/stores/imagePreviewStore.ts +++ b/src/stores/imagePreviewStore.ts @@ -98,12 +98,23 @@ export const useNodeOutputStore = defineStore('nodeOutput', () => { filenames: string | string[] | ResultItem, { folder = 'input', - isAnimated = false - }: { folder?: ResultItemType; isAnimated?: boolean } = {} + isAnimated = false, + isInitialLoad = false + }: { + folder?: ResultItemType + isAnimated?: boolean + isInitialLoad?: boolean + } = {} ) { if (!filenames || !node) return - const nodeId = getMostRecentExecutionId(node) + const nodeId = isInitialLoad + ? executionStore.getNodeLocatorId(node) + : getMostRecentExecutionId(node) + + if (isInitialLoad) { + executionStore.locatorIdToExecutionIdMap.set(nodeId, nodeId) + } if (typeof filenames === 'string') { app.nodeOutputs[nodeId] = createOutputs([filenames], folder, isAnimated)