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.
This commit is contained in:
jluo
2026-02-26 20:51:54 -08:00
parent e1fd6e5bb5
commit b5e67ebe9b
+12 -3
View File
@@ -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());
}
}
},