diff --git a/src/scripts/changeTracker.ts b/src/scripts/changeTracker.ts index 0331079cd9..d098ce763b 100644 --- a/src/scripts/changeTracker.ts +++ b/src/scripts/changeTracker.ts @@ -77,7 +77,7 @@ export class ChangeTracker { scale: app.canvas.ds.scale, offset: [app.canvas.ds.offset[0], app.canvas.ds.offset[1]] } - this.nodeOutputs = clone(app.nodeOutputs) + this.nodeOutputs = useNodeOutputStore().snapshotOutputs() const navigation = useSubgraphNavigationStore().exportState() // Always store the navigation state, even if empty (root level) this.subgraphState = { navigation } diff --git a/src/stores/imagePreviewStore.ts b/src/stores/imagePreviewStore.ts index a01ccfe8a9..8ef589694a 100644 --- a/src/stores/imagePreviewStore.ts +++ b/src/stores/imagePreviewStore.ts @@ -13,6 +13,7 @@ import type { import { appendCloudResParam } from '@/platform/distribution/cloudPreviewUtil' import { api } from '@/scripts/api' import { app } from '@/scripts/app' +import { clone } from '@/scripts/utils' import type { NodeLocatorId } from '@/types/nodeIdentification' import { parseFilePath } from '@/utils/formatUtil' import { isAnimatedOutput, isVideoNode } from '@/utils/litegraphUtil' @@ -365,6 +366,10 @@ export const useNodeOutputStore = defineStore('nodeOutput', () => { return hadOutputs } + function snapshotOutputs(): Record { + return clone(app.nodeOutputs) + } + function restoreOutputs( outputs: Record ) { @@ -455,6 +460,7 @@ export const useNodeOutputStore = defineStore('nodeOutput', () => { revokeAllPreviews, revokeSubgraphPreviews, removeNodeOutputs, + snapshotOutputs, restoreOutputs, resetAllOutputsAndPreviews,