Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

clean state when loading another workflow

Farid Safi393084877c71
diff --git a/web/scripts/app.js b/web/scripts/app.js
index 609cc4cf7..ddb829ab4 100644
--- a/web/scripts/app.js
+++ b/web/scripts/app.js
@@ -903,6 +903,13 @@ class ComfyApp {
}
}
}
+
+ /**
+ * Clean current state
+ */
+ clean() {
+ this.nodeOutputs = {};
+ }
}
export const app = new ComfyApp();
diff --git a/web/scripts/ui.js b/web/scripts/ui.js
index c79caaa9b..7e73c1080 100644
--- a/web/scripts/ui.js
+++ b/web/scripts/ui.js
@@ -306,6 +306,7 @@ export class ComfyUI {
style: { display: "none" },
parent: document.body,
onchange: () => {
+ app.clean();
app.handleFile(fileInput.files[0]);
},
});
@@ -388,8 +389,14 @@ export class ComfyUI {
}),
$el("button", { textContent: "Load", onclick: () => fileInput.click() }),
$el("button", { textContent: "Refresh", onclick: () => app.refreshComboInNodes() }),
- $el("button", { textContent: "Clear", onclick: () => app.graph.clear() }),
- $el("button", { textContent: "Load Default", onclick: () => app.loadGraphData() }),
+ $el("button", { textContent: "Clear", onclick: () => {
+ app.clean();
+ app.graph.clear();
+ }}),
+ $el("button", { textContent: "Load Default", onclick: () => {
+ app.clean();
+ app.loadGraphData();
+ }}),
]);
dragElement(this.menuContainer);