diff --git a/src/scripts/app.ts b/src/scripts/app.ts index 1d7c3f9321..20e9fa2fff 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -1133,13 +1133,15 @@ export class ComfyApp { useMissingModelStore().clearMissingModels() if (clean !== false) { + // Reset canvas context before configuring a new graph so subgraph UI + // state from the previous workflow cannot leak into the newly loaded + // one, and so `clean()` can clear the root graph even when the user is + // currently inside a subgraph. + this.canvas.setGraph(this.rootGraph) + this.clean() } - // Reset canvas context before configuring a new graph so subgraph UI state - // from the previous workflow cannot leak into the newly loaded one. - this.canvas.setGraph(this.rootGraph) - let reset_invalid_values = false // Use explicit validation instead of falsy check to avoid replacing // valid but falsy values (empty objects, 0, false, etc.)