Address PR feedback

This commit is contained in:
Jacob Segal
2025-07-03 14:03:11 -07:00
committed by bymyself
parent cad0f0927a
commit b034e2c326
6 changed files with 25 additions and 57 deletions

View File

@@ -209,15 +209,9 @@ watch(
// Only show progress for running nodes
if (progressState.state === 'running') {
if (node.progress === undefined || node.progress === 0.0) {
console.log(
`${Date.now()} Setting progress for node ${node.id} to ${progressState.value / progressState.max}=${progressState.value}/${progressState.max} due to ${nodeId}`
)
node.progress = progressState.value / progressState.max
} else {
// Update progress if it was already set
console.log(
`${Date.now()} Setting progress for node ${node.id} to Math.min(${node.progress}, ${progressState.value / progressState.max}=${progressState.value}/${progressState.max}) due to ${nodeId}`
)
node.progress = Math.min(
node.progress,
progressState.value / progressState.max
@@ -227,8 +221,8 @@ watch(
}
}
// TODO - Do we need to force canvas redraw here?
// comfyApp.graph.setDirtyCanvas(true, true)
// Force canvas redraw to ensure progress updates are visible
comfyApp.graph.setDirtyCanvas(true, false)
},
{ deep: true }
)

View File

@@ -46,25 +46,24 @@ export const useBrowserTabTitle = () => {
([_, state]) => state.state === 'running'
)
if (runningNodes.length > 0) {
// If multiple nodes are running
if (runningNodes.length > 1) {
return `${executionText.value}[${runningNodes.length} ${t('g.nodesRunning', 'nodes running')}]`
}
// If only one node is running
else {
const [nodeId, state] = runningNodes[0]
const progress = Math.round((state.value / state.max) * 100)
const nodeType =
executionStore.activePrompt?.workflow?.changeTracker?.activeState?.nodes.find(
(n) => String(n.id) === nodeId
)?.type || 'Node'
return `${executionText.value}[${progress}%] ${nodeType}`
}
if (runningNodes.length === 0) {
return ''
}
return ''
// If multiple nodes are running
if (runningNodes.length > 1) {
return `${executionText.value}[${runningNodes.length} ${t('g.nodesRunning', 'nodes running')}]`
}
// If only one node is running
const [nodeId, state] = runningNodes[0]
const progress = Math.round((state.value / state.max) * 100)
const nodeType =
executionStore.activePrompt?.workflow?.changeTracker?.activeState?.nodes.find(
(n) => String(n.id) === nodeId
)?.type || 'Node'
return `${executionText.value}[${progress}%] ${nodeType}`
})
const workflowTitle = computed(

View File

@@ -1225,10 +1225,10 @@ export class GroupNodeHandler {
node.onDrawForeground = function (ctx) {
// @ts-expect-error fixme ts strict error
onDrawForeground?.apply?.(this, arguments)
const executionStore = useExecutionStore()
const progressState = useExecutionStore().nodeProgressStates[this.id]
if (
executionStore.nodeProgressStates[this.id] &&
executionStore.nodeProgressStates[this.id].state === 'running' &&
progressState &&
progressState.state === 'running' &&
this.runningInternalNodeId !== null
) {
// @ts-expect-error fixme ts strict error

View File

@@ -237,7 +237,7 @@ export class ComponentWidgetImpl<
component: Component
inputSpec: InputSpec
props?: P
componentProps?: Record<string, unknown>
componentProps?: Partial<P>
options: DOMWidgetOptions<V>
}) {
super({

View File

@@ -363,12 +363,9 @@ export const useLitegraphService = () => {
*/
#setupStrokeStyles() {
this.strokeStyles['running'] = function (this: LGraphNode) {
const nodeProgressStates = useExecutionStore().nodeProgressStates
const nodeId = String(this.id)
if (
nodeProgressStates[nodeId] &&
nodeProgressStates[nodeId].state === 'running'
) {
const state = useExecutionStore().nodeProgressStates[nodeId]?.state
if (state === 'running') {
return { color: '#0f0' }
}
}

View File

@@ -23,6 +23,7 @@ import type {
NodeId
} from '@/schemas/comfyWorkflowSchema'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
import { useCanvasStore } from './graphStore'
import { ComfyWorkflow, useWorkflowStore } from './workflowStore'
@@ -110,29 +111,6 @@ export const useExecutionStore = defineStore('execution', () => {
return getSubgraphsFromInstanceIds(subgraph, subgraphNodeIds, subgraphs)
}
const executionIdToCurrentId = (id: string) => {
const subgraph = workflowStore.activeSubgraph
// Short-circuit: ID belongs to the parent workflow / no active subgraph
if (!id.includes(':')) {
return !subgraph ? id : undefined
} else if (!subgraph) {
return
}
// Parse the hierarchical ID (e.g., "123:456:789")
const subgraphNodeIds = id.split(':')
// If the last subgraph is the active subgraph, return the node ID
const subgraphs = getSubgraphsFromInstanceIds(
subgraph.rootGraph,
subgraphNodeIds
)
if (subgraphs.at(-1) === subgraph) {
return subgraphNodeIds.at(-1)
}
}
// This is the progress of the currently executing node (for backward compatibility)
const _executingNodeProgress = ref<ProgressWsMessage | null>(null)
const executingNodeProgress = computed(() =>