Fix options not resetting when option text is emptied

This commit is contained in:
relhamdi
2026-05-21 11:09:45 +02:00
parent b3f05777d4
commit f9d2492189
+9 -2
View File
@@ -18,14 +18,21 @@ function attachOptionPicker(node) {
if (!raw.trim()) return null;
const lines = raw.split("\n").map((l) => l.trim());
if (!lines.length) return null;
const hasContent = lines.some((l) => l !== "");
if (!hasContent) return null;
return lines.map((l) => (l === "" ? "--" : l));
};
const refreshDropdown = () => {
const options = parseOptions();
if (!options) return;
if (!options) {
// Reset dropdown to default empty state
selectedWidget.options.values = ["--"];
selectedWidget.value = "--";
if (node.graph) node.graph.setDirtyCanvas(true, true);
return;
}
const current = selectedWidget.value;
selectedWidget.options.values = options;