move clean to handleFile and loadGraphData functions

This commit is contained in:
Farid Safi 2023-03-28 20:22:49 +02:00
parent 393084877c
commit 40a377775e
2 changed files with 3 additions and 5 deletions

View File

@ -721,6 +721,8 @@ class ComfyApp {
* @param {*} graphData A serialized graph object
*/
loadGraphData(graphData) {
this.clean();
if (!graphData) {
graphData = defaultGraph;
}

View File

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