From 986128076ebfb7f495398ee55e77bb8722d03f67 Mon Sep 17 00:00:00 2001 From: Will Miao Date: Sun, 26 Jul 2026 21:54:37 +0800 Subject: [PATCH] fix(widget): guard setValue against non-array input to prevent workflow load crash (#1039) --- web/comfyui/loras_widget.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/comfyui/loras_widget.js b/web/comfyui/loras_widget.js index ede0bef3..8a9e1c16 100644 --- a/web/comfyui/loras_widget.js +++ b/web/comfyui/loras_widget.js @@ -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