From b5e67ebe9b37d993fdbf1e8b8219f51508193bb0 Mon Sep 17 00:00:00 2001 From: jluo Date: Thu, 26 Feb 2026 20:51:54 -0800 Subject: [PATCH] fix: sync size dropdown with model on workflow load Hook into node.configure() to re-run size filtering after ComfyUI restores saved widget values, fixing the race condition where illustrious model showed qwen dropdown options on load. --- js/auto_size.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/js/auto_size.js b/js/auto_size.js index 5ea273d..029b7dc 100644 --- a/js/auto_size.js +++ b/js/auto_size.js @@ -50,16 +50,25 @@ app.registerExtension({ // Add callback to model widget const originalCallback = modelWidget.callback; modelWidget.callback = function () { - // ComfyUI widgets usually update .value before callback, but just in case - // we can check 'this.value' or 'modelWidget.value'. updateSizeOptions(); if (originalCallback) { originalCallback.apply(this, arguments); } }; - // Initial update + // Hook into configure() — fires AFTER saved widget values are restored + const originalConfigure = node.configure; + node.configure = function (info) { + if (originalConfigure) { + originalConfigure.apply(this, arguments); + } + // Values are now restored from the saved workflow, re-sync dropdown + updateSizeOptions(); + }; + + // Initial update + deferred safety net for edge cases updateSizeOptions(); + requestAnimationFrame(() => updateSizeOptions()); } } },