mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-06 22:10:14 -03:00
fix(widget): guard setValue against non-array input to prevent workflow load crash (#1039)
This commit is contained in:
@@ -718,8 +718,10 @@ export function addLorasWidget(node, name, opts, callback) {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
setValue: function(v) {
|
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
|
// 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
|
// Remove any existing lora with the same name
|
||||||
const filtered = acc.filter(l => l.name !== lora.name);
|
const filtered = acc.filter(l => l.name !== lora.name);
|
||||||
// Add the current lora
|
// Add the current lora
|
||||||
|
|||||||
Reference in New Issue
Block a user