Address PR feedback

This commit is contained in:
Jacob Segal
2025-07-11 15:58:31 -07:00
parent 868e047272
commit 0887bb6654
3 changed files with 10 additions and 54 deletions

View File

@@ -1277,45 +1277,6 @@ export class GroupNodeHandler {
// @ts-expect-error fixme ts strict error
(_, id) => id
)
/*
// Handle progress_state events for multiple executing nodes
const progress_state = handleEvent.call(
this,
'progress_state',
(d) => {
// Check if any of our inner nodes are in this progress state update
for (const nodeId in d.nodes) {
const innerNodeIndex = this.innerNodes?.findIndex((n) => n.id == nodeId);
if (innerNodeIndex > -1) return nodeId;
}
return null;
},
(d, id, node) => {
// Create a new progress_state event with just our group node
const newProgressState = { ...d };
newProgressState.nodes = { [id]: {
node: id,
state: 'running',
value: 0,
max: 1,
prompt_id: d.prompt_id
}};
// If we have a specific running internal node, update its state
if (node.runningInternalNodeId !== null) {
const innerNodeId = this.innerNodes[node.runningInternalNodeId].id;
if (d.nodes[innerNodeId]) {
newProgressState.nodes[id] = {
...d.nodes[innerNodeId],
node: id
};
}
}
return newProgressState;
}
);
*/
const executed = handleEvent.call(
this,

View File

@@ -90,17 +90,13 @@ export const useExecutionStore = defineStore('execution', () => {
return mergedState
} else if (newState.state === 'running') {
const newPerc = newState.max > 0 ? newState.value / newState.max : 0.0
if (mergedState.state === 'running') {
const oldPerc =
mergedState.max > 0 ? mergedState.value / mergedState.max : 0.0
if (oldPerc === 0.0) {
mergedState.value = newState.value
mergedState.max = newState.max
} else if (newPerc < oldPerc) {
mergedState.value = newState.value
mergedState.max = newState.max
}
} else {
const oldPerc =
mergedState.max > 0 ? mergedState.value / mergedState.max : 0.0
if (
mergedState.state !== 'running' ||
oldPerc === 0.0 ||
newPerc < oldPerc
) {
mergedState.value = newState.value
mergedState.max = newState.max
}
@@ -117,7 +113,6 @@ export const useExecutionStore = defineStore('execution', () => {
const states = nodeProgressStates.value // Apparently doing this inside `Object.entries` causes issues
for (const [_, state] of Object.entries(states)) {
// Convert the node ID to a NodeLocatorId
const parts = String(state.display_node_id).split(':')
for (let i = 0; i < parts.length; i++) {
const executionId = parts.slice(0, i + 1).join(':')
@@ -141,7 +136,7 @@ export const useExecutionStore = defineStore('execution', () => {
.map(([nodeId, _]) => nodeId)
})
// For backward compatibility - stores the primary executing node ID
// @deprecated For backward compatibility - stores the primary executing node ID
const executingNodeId = computed<NodeId | null>(() => {
return executingNodeIds.value.length > 0 ? executingNodeIds.value[0] : null
})

View File

@@ -15,7 +15,7 @@ import type { NodeId } from '@/schemas/comfyWorkflowSchema'
* Unlike hierarchical IDs which change based on the instance path,
* NodeLocatorId remains the same for all instances of a particular node.
*/
export type NodeLocatorId = string & { __brand: 'NodeLocatorId' }
export type NodeLocatorId = string
/**
* A hierarchical identifier representing a node's position in nested subgraphs.
@@ -24,7 +24,7 @@ export type NodeLocatorId = string & { __brand: 'NodeLocatorId' }
* Format: Colon-separated path of node IDs
* Example: "123:456:789" (node 789 in subgraph 456 in subgraph 123)
*/
export type HierarchicalNodeId = string & { __brand: 'HierarchicalNodeId' }
export type HierarchicalNodeId = string
/**
* Type guard to check if a value is a NodeLocatorId