Skip to content

Commit 052d532

Browse files
Revert PRs #4506 and #4507 - Fix execution output issues (#4508)
1 parent e34d9bb commit 052d532

File tree

4 files changed

+11
-59
lines changed

4 files changed

+11
-59
lines changed

src/composables/widgets/useImageUploadWidget.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ 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,
104-
isInitialLoad: true
103+
isAnimated
105104
})
106105
node.graph?.setDirtyCanvas(true)
107106
}
@@ -111,8 +110,7 @@ export const useImageUploadWidget = () => {
111110
// No change callbacks seem to be fired on initial setting of the value
112111
requestAnimationFrame(() => {
113112
nodeOutputStore.setNodeOutputs(node, fileComboWidget.value, {
114-
isAnimated,
115-
isInitialLoad: true
113+
isAnimated
116114
})
117115
showPreview({ block: false })
118116
})

src/stores/executionStore.ts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { LGraph, LGraphNode, Subgraph } from '@comfyorg/litegraph'
1+
import type { LGraph, Subgraph } from '@comfyorg/litegraph'
22
import { defineStore } from 'pinia'
33
import { computed, ref } from 'vue'
44

@@ -24,7 +24,7 @@ import type {
2424
} from '@/schemas/comfyWorkflowSchema'
2525
import { api } from '@/scripts/api'
2626
import { app } from '@/scripts/app'
27-
import type { NodeExecutionId, NodeLocatorId } from '@/types/nodeIdentification'
27+
import type { NodeLocatorId } from '@/types/nodeIdentification'
2828
import { createNodeLocatorId } from '@/types/nodeIdentification'
2929

3030
import { useCanvasStore } from './graphStore'
@@ -54,22 +54,6 @@ export const useExecutionStore = defineStore('execution', () => {
5454
// This is the progress of all nodes in the currently executing workflow
5555
const nodeProgressStates = ref<Record<string, NodeProgressState>>({})
5656

57-
/**
58-
* @deprecated Workaround for Subgraph phase 1 - execution IDs may share locator IDs.
59-
* The most recently executed execution ID for each node locator ID.
60-
*/
61-
const locatorIdToExecutionIdMap = new Map<NodeLocatorId, NodeExecutionId>()
62-
63-
/**
64-
* Get the NodeLocatorId for a node.
65-
* @param node The node
66-
* @returns The NodeLocatorId
67-
*/
68-
const getNodeLocatorId = (node: LGraphNode): NodeLocatorId =>
69-
node.graph?.isRootGraph
70-
? node.id.toString()
71-
: [node.graph?.id, node.id].join(':')
72-
7357
/**
7458
* Convert execution context node IDs to NodeLocatorIds
7559
* @param nodeId The node ID from execution context (could be execution ID)
@@ -484,8 +468,6 @@ export const useExecutionStore = defineStore('execution', () => {
484468
_executingNodeProgress,
485469
// NodeLocatorId conversion helpers
486470
executionIdToNodeLocatorId,
487-
nodeLocatorIdToExecutionId,
488-
locatorIdToExecutionIdMap,
489-
getNodeLocatorId
471+
nodeLocatorIdToExecutionId
490472
}
491473
})

src/stores/imagePreviewStore.ts

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ import {
88
} from '@/schemas/apiSchema'
99
import { api } from '@/scripts/api'
1010
import { app } from '@/scripts/app'
11-
import type { NodeExecutionId } from '@/types'
1211
import { parseFilePath } from '@/utils/formatUtil'
1312
import { isVideoNode } from '@/utils/litegraphUtil'
1413

15-
import { useExecutionStore } from './executionStore'
16-
1714
const createOutputs = (
1815
filenames: string[],
1916
type: ResultItemType,
@@ -26,20 +23,16 @@ const createOutputs = (
2623
}
2724

2825
export const useNodeOutputStore = defineStore('nodeOutput', () => {
29-
const executionStore = useExecutionStore()
30-
const getMostRecentExecutionId = (node: LGraphNode): NodeExecutionId =>
31-
executionStore.locatorIdToExecutionIdMap.get(
32-
executionStore.getNodeLocatorId(node)
33-
) ?? node.id.toString()
26+
const getNodeId = (node: LGraphNode): string => node.id.toString()
3427

3528
function getNodeOutputs(
3629
node: LGraphNode
3730
): ExecutedWsMessage['output'] | undefined {
38-
return app.nodeOutputs[getMostRecentExecutionId(node)]
31+
return app.nodeOutputs[getNodeId(node)]
3932
}
4033

4134
function getNodePreviews(node: LGraphNode): string[] | undefined {
42-
return app.nodePreviewImages[getMostRecentExecutionId(node)]
35+
return app.nodePreviewImages[getNodeId(node)]
4336
}
4437

4538
/**
@@ -98,23 +91,12 @@ export const useNodeOutputStore = defineStore('nodeOutput', () => {
9891
filenames: string | string[] | ResultItem,
9992
{
10093
folder = 'input',
101-
isAnimated = false,
102-
isInitialLoad = false
103-
}: {
104-
folder?: ResultItemType
105-
isAnimated?: boolean
106-
isInitialLoad?: boolean
107-
} = {}
94+
isAnimated = false
95+
}: { folder?: ResultItemType; isAnimated?: boolean } = {}
10896
) {
10997
if (!filenames || !node) return
11098

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

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

src/utils/executionUtil.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import type {
1414
ComfyApiWorkflow,
1515
ComfyWorkflowJSON
1616
} from '@/schemas/comfyWorkflowSchema'
17-
import { useExecutionStore } from '@/stores/executionStore'
1817

1918
import { ExecutableGroupNodeDTO, isGroupNode } from './executableGroupNodeDto'
2019
import { compressWidgetInputSlots } from './litegraphUtil'
@@ -59,8 +58,6 @@ export const graphToPrompt = async (
5958
options: { sortNodes?: boolean; queueNodeIds?: NodeId[] } = {}
6059
): Promise<{ workflow: ComfyWorkflowJSON; output: ComfyApiWorkflow }> => {
6160
const { sortNodes = false, queueNodeIds } = options
62-
const executionStore = useExecutionStore()
63-
executionStore.locatorIdToExecutionIdMap.clear()
6461

6562
for (const node of graph.computeExecutionOrder(false)) {
6663
const innerNodes = node.getInnerNodes
@@ -162,13 +159,6 @@ export const graphToPrompt = async (
162159
]
163160
}
164161

165-
// Temporary workaround for Subgraph phase 1. Overwrites the ID, but keeps the image.
166-
const baseNodeId = node.id.split(':').at(-1)
167-
executionStore.locatorIdToExecutionIdMap.set(
168-
`${node.subgraphId}:${baseNodeId}`,
169-
node.id
170-
)
171-
172162
output[String(node.id)] = {
173163
inputs,
174164
// TODO(huchenlei): Filter out all nodes that cannot be mapped to a

0 commit comments

Comments
 (0)