mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 10:12:11 +00:00
fix restoring outputs in Vue nodes (persisting node outputs when switching between workflow tabs) (#5788)
## Summary Fixed Vue node output restoration by consolidating state management through the node output store. ## Changes - **What**: Refactored node output cleanup and restoration logic in `ChangeTracker` and `ComfyApp` to use centralized store methods - **Breaking**: Removed direct manipulation of `app.nodeOutputs` in favor of store-managed state ## Review Focus State synchronization between `app.nodeOutputs` and `nodeOutputs.value` during restore/reset operations, ensuring Vue reactivity is maintained. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5788-fix-restoring-outputs-in-Vue-nodes-persisting-node-outputs-when-switching-between-workfl-27a6d73d365081b39411fed7479d8ac5) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -328,6 +328,19 @@ export const useNodeOutputStore = defineStore('nodeOutput', () => {
|
||||
return hadOutputs
|
||||
}
|
||||
|
||||
function restoreOutputs(
|
||||
outputs: Record<string, ExecutedWsMessage['output']>
|
||||
) {
|
||||
app.nodeOutputs = outputs
|
||||
nodeOutputs.value = outputs
|
||||
}
|
||||
|
||||
function resetAllOutputsAndPreviews() {
|
||||
app.nodeOutputs = {}
|
||||
nodeOutputs.value = {}
|
||||
revokeAllPreviews()
|
||||
}
|
||||
|
||||
return {
|
||||
// Getters
|
||||
getNodeOutputs,
|
||||
@@ -346,6 +359,8 @@ export const useNodeOutputStore = defineStore('nodeOutput', () => {
|
||||
revokeAllPreviews,
|
||||
revokeSubgraphPreviews,
|
||||
removeNodeOutputs,
|
||||
restoreOutputs,
|
||||
resetAllOutputsAndPreviews,
|
||||
|
||||
// State
|
||||
nodeOutputs,
|
||||
|
||||
Reference in New Issue
Block a user