mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
fix: rehydrate nodeProgressStates on workflow tab switch
Adds a watcher on workflowStore.activeWorkflow?.path that syncs the "current view" nodeProgressStates from nodeProgressStatesByJob when the user switches tabs, preventing stale progress from the previous workflow from being displayed. Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10689#discussion_r3005427994
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref, shallowRef } from 'vue'
|
||||
import { computed, ref, shallowRef, watch } from 'vue'
|
||||
|
||||
import { useNodeProgressText } from '@/composables/node/useNodeProgressText'
|
||||
import { isCloud } from '@/platform/distribution/types'
|
||||
@@ -645,6 +645,28 @@ export const useExecutionStore = defineStore('execution', () => {
|
||||
return jobPath === activePath
|
||||
}
|
||||
|
||||
// Rehydrate the "current view" progress when the user switches workflow tabs
|
||||
// so stale progress from the previous tab is not displayed.
|
||||
watch(
|
||||
() => workflowStore.activeWorkflow?.path,
|
||||
(newPath) => {
|
||||
if (!newPath) {
|
||||
nodeProgressStates.value = {}
|
||||
return
|
||||
}
|
||||
// Find the most recent job that belongs to the new active workflow
|
||||
const jobEntries = Object.entries(nodeProgressStatesByJob.value)
|
||||
for (let i = jobEntries.length - 1; i >= 0; i--) {
|
||||
const [jobId, states] = jobEntries[i]
|
||||
if (jobIdToSessionWorkflowPath.value.get(jobId) === newPath) {
|
||||
nodeProgressStates.value = states
|
||||
return
|
||||
}
|
||||
}
|
||||
nodeProgressStates.value = {}
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
isIdle,
|
||||
clientId,
|
||||
|
||||
Reference in New Issue
Block a user