mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
feat: restore running job context on page refresh
Extend ExecutionStartWsMessage schema with optional outputs_to_execute and executed_node_ids fields. Populate node tracking in handleExecutionStart so progress bars and node highlighting restore correctly when the backend replays catch-up events on WS reconnect.
This commit is contained in:
@@ -88,7 +88,10 @@ const zExecutionWsMessageBase = z.object({
|
||||
timestamp: z.number().int()
|
||||
})
|
||||
|
||||
const zExecutionStartWsMessage = zExecutionWsMessageBase
|
||||
const zExecutionStartWsMessage = zExecutionWsMessageBase.extend({
|
||||
outputs_to_execute: z.array(zNodeId).optional(),
|
||||
executed_node_ids: z.array(zNodeId).optional()
|
||||
})
|
||||
const zExecutionSuccessWsMessage = zExecutionWsMessageBase
|
||||
const zExecutionCachedWsMessage = zExecutionWsMessageBase.extend({
|
||||
nodes: z.array(zNodeId)
|
||||
|
||||
@@ -289,6 +289,23 @@ export const useExecutionStore = defineStore('execution', () => {
|
||||
lastExecutionError.value = null
|
||||
activePromptId.value = e.detail.prompt_id
|
||||
queuedPrompts.value[activePromptId.value] ??= { nodes: {} }
|
||||
|
||||
const outputsToExecute = e.detail.outputs_to_execute
|
||||
if (outputsToExecute?.length) {
|
||||
const qp = queuedPrompts.value[activePromptId.value]
|
||||
for (const nodeId of outputsToExecute) {
|
||||
qp.nodes[nodeId] ??= false
|
||||
}
|
||||
}
|
||||
|
||||
const executedNodeIds = e.detail.executed_node_ids
|
||||
if (executedNodeIds?.length) {
|
||||
const qp = queuedPrompts.value[activePromptId.value]
|
||||
for (const nodeId of executedNodeIds) {
|
||||
qp.nodes[nodeId] = true
|
||||
}
|
||||
}
|
||||
|
||||
clearInitializationByPromptId(activePromptId.value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user