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.

move clean to handleFile and loadGraphData functions

Farid Safi40a377775e7e
diff --git a/web/scripts/app.js b/web/scripts/app.js
index ddb829ab4..cd7fb5d1b 100644
--- a/web/scripts/app.js
+++ b/web/scripts/app.js
@@ -721,6 +721,8 @@ class ComfyApp {
* @param {*} graphData A serialized graph object
*/
loadGraphData(graphData) {
+ this.clean();
+
if (!graphData) {
graphData = defaultGraph;
}
diff --git a/web/scripts/ui.js b/web/scripts/ui.js
index 7e73c1080..2aabd29e7 100644
--- a/web/scripts/ui.js
+++ b/web/scripts/ui.js
@@ -306,7 +306,6 @@ export class ComfyUI {
style: { display: "none" },
parent: document.body,
onchange: () => {
- app.clean();
app.handleFile(fileInput.files[0]);
},
});
@@ -393,10 +392,7 @@ export class ComfyUI {
app.clean();
app.graph.clear();
}}),
- $el("button", { textContent: "Load Default", onclick: () => {
- app.clean();
- app.loadGraphData();
- }}),
+ $el("button", { textContent: "Load Default", onclick: () => app.loadGraphData() }),
]);
dragElement(this.menuContainer);