fix(widget): guard setValue against non-array input to prevent workflow load crash (#1039)

This commit is contained in:
Will Miao
2026-07-26 21:54:37 +08:00
parent 1de0a53241
commit 986128076e

View File

@@ -718,8 +718,10 @@ export function addLorasWidget(node, name, opts, callback) {
});
},
setValue: function(v) {
// Ensure v is an array; handle falsy, string, or object values safely
v = Array.isArray(v) ? v : [];
// Remove duplicates by keeping the last occurrence of each lora name
const uniqueValue = (v || []).reduce((acc, lora) => {
const uniqueValue = v.reduce((acc, lora) => {
// Remove any existing lora with the same name
const filtered = acc.filter(l => l.name !== lora.name);
// Add the current lora