From 7ca7d95ef31f19e42593eaf92b191f5b7648fd7b Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Wed, 24 Jun 2026 15:11:54 +0200 Subject: [PATCH] feat(workflow): make auto-open on load opt-in; default off Loading a workflow with missing/disabled nodes no longer pops the Node Stats dialog every time. Gated behind a new ComfyUI setting "Auto-open Node Stats on workflow load" (off by default); the scan still runs so the Workflow tab is accurate when opened manually. Bump to 1.7.2. Co-Authored-By: Claude Opus 4.8 --- js/nodes_stats.js | 29 +++++++++++++++++++++++++++++ pyproject.toml | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/js/nodes_stats.js b/js/nodes_stats.js index 1088db6..767221f 100644 --- a/js/nodes_stats.js +++ b/js/nodes_stats.js @@ -24,9 +24,35 @@ const STATUS_META = { // Tiers that may offer a "Disable" action (when ComfyUI Manager is available). const DISABLEABLE_TIERS = new Set(["safe_to_remove", "consider_removing"]); +// Setting id for the auto-open-on-load behavior. Defaults to off so loading a +// workflow with missing/disabled nodes no longer pops the dialog every time. +const SETTING_AUTO_OPEN = "comfyui.nodes_stats.autoOpenOnLoad"; + +function autoOpenEnabled() { + try { + const v = app.extensionManager?.setting?.get(SETTING_AUTO_OPEN); + if (v !== undefined) return !!v; + return !!app.ui?.settings?.getSettingValue?.(SETTING_AUTO_OPEN, false); + } catch { + return false; + } +} + app.registerExtension({ name: "comfyui.nodes_stats", + settings: [ + { + id: SETTING_AUTO_OPEN, + name: "Auto-open Node Stats on workflow load", + tooltip: + "Pop the Node Stats dialog (Workflow tab) automatically when a loaded workflow has missing or disabled nodes. Off by default — open it manually from the toolbar instead.", + type: "boolean", + defaultValue: false, + category: ["Node Stats", "Behavior", "Auto-open on load"], + }, + ], + async setup() { const btn = document.createElement("button"); btn.innerHTML = STATS_ICON; @@ -96,6 +122,9 @@ let _lastWorkflowScan = { disabled: [], missing: [] }; async function onWorkflowLoaded() { const types = unresolvedNodeTypes(); _lastWorkflowScan = await classifyUnresolved(types); + // Only auto-open when the user has opted in; the scan is still kept up to date + // so the Workflow tab is accurate when opened manually from the toolbar. + if (!autoOpenEnabled()) return; if (_lastWorkflowScan.disabled.length || _lastWorkflowScan.missing.length) { showStatsDialog("workflow"); // auto-open on the Workflow tab } diff --git a/pyproject.toml b/pyproject.toml index 8d0bcb8..b0673f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-nodes-stats" description = "Track usage statistics for all ComfyUI nodes and packages" -version = "1.7.1" +version = "1.7.2" license = "MIT" [project.urls]