From 4cbd8fd0a9f539f36448ad26b6f605f445a64cc9 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Tue, 24 Feb 2026 20:55:22 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20workflow=20key=20detection=20=E2=80=94=20?= =?UTF-8?q?use=20extensionManager.workflow=20store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit app.workflowManager doesn't exist in the modern Vue-based frontend. The active workflow is accessed via the Pinia store at app.extensionManager.workflow.activeWorkflow. Also replaces the non-existent addEventListener("changeWorkflow") with Pinia's $onAction watching for "openWorkflow" actions. Co-Authored-By: Claude Opus 4.6 --- js/snapshot_manager.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/js/snapshot_manager.js b/js/snapshot_manager.js index 205efdf..e4777ed 100644 --- a/js/snapshot_manager.js +++ b/js/snapshot_manager.js @@ -207,7 +207,7 @@ function quickHash(str) { function getWorkflowKey() { try { - const wf = app.workflowManager?.activeWorkflow; + const wf = app.extensionManager?.workflow?.activeWorkflow; return wf?.key || wf?.filename || wf?.path || "default"; } catch { return "default"; @@ -1130,17 +1130,22 @@ if (window.__COMFYUI_FRONTEND_VERSION__) { scheduleCaptureSnapshot(); }); - // Listen for workflow switches - if (app.workflowManager) { - app.workflowManager.addEventListener("changeWorkflow", () => { - // Cancel any pending capture from the previous workflow - if (captureTimer) { - clearTimeout(captureTimer); - captureTimer = null; - } - viewingWorkflowKey = null; - if (sidebarRefresh) { - sidebarRefresh(true).catch(() => {}); + // Listen for workflow switches via Pinia store action + const workflowStore = app.extensionManager?.workflow; + if (workflowStore?.$onAction) { + workflowStore.$onAction(({ name, after }) => { + if (name === "openWorkflow") { + after(() => { + // Cancel any pending capture from the previous workflow + if (captureTimer) { + clearTimeout(captureTimer); + captureTimer = null; + } + viewingWorkflowKey = null; + if (sidebarRefresh) { + sidebarRefresh(true).catch(() => {}); + } + }); } }); }