Compare commits

...
Author SHA1 Message Date
Alexander Brown 910bef52e4 Apply suggestion from @DrJKL 2026-10-24 12:36:09 -07:00
Alexander Brown 5fe4b0cea7 Reload components on clear of any root graph
ComfyUI_frontend is moving to one LGraph instance per workflow tab
(Comfy-Org/ComfyUI_frontend#21571), and app.clean() clears the new graph
before any extension hook fires. The instance patch on app.graph.clear
only reaches the graph that existed at startup, so components would not
be reloaded for later workflows.

Patch clear on the graph prototype and reload components when the
cleared graph is the current root graph. This also stops a subgraph
clear from clearing the root graph, which the old wrapper did by always
calling orig_clear on app.graph.

Amp-Thread-ID: https://ampcode.com/threads/T-d545a10a-f002-4dc5-9a74-f6402a836919
2026-10-24 05:56:26 +00:00
+5 -4
View File
@@ -1536,10 +1536,11 @@ app.registerExtension({
});
},
async setup() {
let orig_clear = app.graph.clear;
app.graph.clear = function () {
orig_clear.call(app.graph);
load_components();
const graphProto = Object.getPrototypeOf(app.graph);
const orig_clear = graphProto.clear;
graphProto.clear = function () {
orig_clear.apply(this, arguments);
if (this === app.graph) load_components();
};
load_components();