Skip to content

Commit e34d9bb

Browse files
authored
Fix LoadImage bleeds values between subgraphs (#4507)
1 parent f81b191 commit e34d9bb

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/composables/widgets/useImageUploadWidget.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ export const useImageUploadWidget = () => {
100100
// Add our own callback to the combo widget to render an image when it changes
101101
fileComboWidget.callback = function () {
102102
nodeOutputStore.setNodeOutputs(node, fileComboWidget.value, {
103-
isAnimated
103+
isAnimated,
104+
isInitialLoad: true
104105
})
105106
node.graph?.setDirtyCanvas(true)
106107
}
@@ -110,7 +111,8 @@ export const useImageUploadWidget = () => {
110111
// No change callbacks seem to be fired on initial setting of the value
111112
requestAnimationFrame(() => {
112113
nodeOutputStore.setNodeOutputs(node, fileComboWidget.value, {
113-
isAnimated
114+
isAnimated,
115+
isInitialLoad: true
114116
})
115117
showPreview({ block: false })
116118
})

src/stores/imagePreviewStore.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,23 @@ export const useNodeOutputStore = defineStore('nodeOutput', () => {
9898
filenames: string | string[] | ResultItem,
9999
{
100100
folder = 'input',
101-
isAnimated = false
102-
}: { folder?: ResultItemType; isAnimated?: boolean } = {}
101+
isAnimated = false,
102+
isInitialLoad = false
103+
}: {
104+
folder?: ResultItemType
105+
isAnimated?: boolean
106+
isInitialLoad?: boolean
107+
} = {}
103108
) {
104109
if (!filenames || !node) return
105110

106-
const nodeId = getMostRecentExecutionId(node)
111+
const nodeId = isInitialLoad
112+
? executionStore.getNodeLocatorId(node)
113+
: getMostRecentExecutionId(node)
114+
115+
if (isInitialLoad) {
116+
executionStore.locatorIdToExecutionIdMap.set(nodeId, nodeId)
117+
}
107118

108119
if (typeof filenames === 'string') {
109120
app.nodeOutputs[nodeId] = createOutputs([filenames], folder, isAnimated)

0 commit comments

Comments
 (0)