Skip to content

Commit 27c5bc1

Browse files
Update state when graph cleared via UI (#88)
1 parent c4b6c9f commit 27c5bc1

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/scripts/changeTracker.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ export class ChangeTracker {
160160
changeTracker().checkState();
161161
});
162162

163+
api.addEventListener("graphCleared", () => {
164+
changeTracker().checkState();
165+
});
166+
163167
// Handle litegraph clicks
164168
// @ts-ignore
165169
const processMouseUp = LGraphCanvas.prototype.processMouseUp;

src/scripts/ui.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ export class ComfyUI {
706706
app.clean();
707707
app.graph.clear();
708708
app.resetView();
709+
api.dispatchEvent(new CustomEvent("graphCleared"));
709710
}
710711
},
711712
}),

src/scripts/ui/menu/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @ts-nocheck
22

3+
import { api } from "../../api";
34
import { $el } from "../../ui";
45
import { downloadBlob } from "../../utils";
56
import { ComfyButton } from "../components/button";
@@ -112,6 +113,7 @@ export class ComfyAppMenu {
112113
) {
113114
app.clean();
114115
app.graph.clear();
116+
api.dispatchEvent(new CustomEvent("graphCleared"));
115117
}
116118
},
117119
})

0 commit comments

Comments
 (0)