fix: reset canvas graph before cleaning workflow load

Amp-Thread-ID: https://ampcode.com/threads/T-019d0283-9968-71ae-8051-382712e0e360
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-03-18 13:35:30 -07:00
parent b19699770c
commit 44bb6f134b

View File

@@ -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.)