Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1778,9 +1778,8 @@ export class ComfyApp {
* Clean current state
*/
clean() {
this.nodeOutputs = {}
const { revokeAllPreviews } = useNodeOutputStore()
revokeAllPreviews()
const nodeOutputStore = useNodeOutputStore()
nodeOutputStore.resetAllOutputsAndPreviews()
const executionStore = useExecutionStore()
executionStore.lastNodeErrors = null
executionStore.lastExecutionError = null
Expand Down
5 changes: 2 additions & 3 deletions src/scripts/changeTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import type { ComfyWorkflowJSON } from '@/platform/workflow/validation/schemas/workflowSchema'
import type { ExecutedWsMessage } from '@/schemas/apiSchema'
import { useExecutionStore } from '@/stores/executionStore'
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
import { useSubgraphNavigationStore } from '@/stores/subgraphNavigationStore'

import { api } from './api'
Expand Down Expand Up @@ -85,9 +86,7 @@ export class ChangeTracker {
app.canvas.ds.scale = this.ds.scale
app.canvas.ds.offset = this.ds.offset
}
if (this.nodeOutputs) {
app.nodeOutputs = this.nodeOutputs
}
useNodeOutputStore().restoreOutputs(this.nodeOutputs ?? {})
if (this.subgraphState) {
const { navigation } = this.subgraphState
useSubgraphNavigationStore().restoreState(navigation)
Expand Down
15 changes: 15 additions & 0 deletions src/stores/imagePreviewStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -346,6 +359,8 @@ export const useNodeOutputStore = defineStore('nodeOutput', () => {
revokeAllPreviews,
revokeSubgraphPreviews,
removeNodeOutputs,
restoreOutputs,
resetAllOutputsAndPreviews,

// State
nodeOutputs,
Expand Down