diff --git a/js/comfyui-manager.js b/js/comfyui-manager.js index 138708b65..efca23dec 100644 --- a/js/comfyui-manager.js +++ b/js/comfyui-manager.js @@ -1536,10 +1536,14 @@ app.registerExtension({ }); }, async setup() { - let orig_clear = app.graph.clear; - app.graph.clear = function () { - orig_clear.call(app.graph); - load_components(); + // Patch the prototype rather than the app.graph instance: newer frontends + // create a separate graph per workflow tab, so an instance patch would only + // ever see the graph that existed at startup. + 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();