From fc1bba6a4e4dbfc4e8f1a07eae9a455e71ee29ab Mon Sep 17 00:00:00 2001 From: doggeddalle <153059103+cicalooo@users.noreply.github.com> Date: Sun, 9 Aug 2026 18:54:17 +1000 Subject: [PATCH] Remove module-level Lora list cache Eliminates the module-global loraListPromise and makes fetchLoraList always query /object_info/LoraLoaderModelOnly. This avoids caching a promise (which could be serialized into saved workflows or return stale folder listings) and simplifies error handling to log and return an empty list. Comments updated to reflect per-open fetching. --- web/h3_power_lora_stack.js | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/web/h3_power_lora_stack.js b/web/h3_power_lora_stack.js index e757f40..feda02a 100644 --- a/web/h3_power_lora_stack.js +++ b/web/h3_power_lora_stack.js @@ -16,32 +16,22 @@ const ROW_FORMAT_KEY = "h3RowFormat"; const ROW_FORMAT = 2; const LEGACY_BUTTON_SLOTS = 3; -// Session cache for the loras folder listing. Deliberately a module global -// rather than graph.extra: anything hung off the graph is serialized into the -// saved workflow, which would bake a stale copy of the whole folder into every -// .json. The promise itself is cached so N rows opening at once share one -// request. -let loraListPromise = null; - /** * The stack node declares no ``lora_name`` input of its own -- rows are added - * in the browser -- so the folder listing is borrowed from a node that does. + * in the browser -- so the current folder listing is borrowed from a node that + * does each time the picker opens. */ function fetchLoraList() { - if (!loraListPromise) { - loraListPromise = api - .fetchApi("/object_info/LoraLoaderModelOnly") - .then((res) => res.json()) - .then( - (info) => info?.LoraLoaderModelOnly?.input?.required?.lora_name?.[0] ?? [] - ) - .catch((err) => { - console.warn("[H3PowerLoraStack] could not fetch lora list", err); - loraListPromise = null; // let the next picker retry - return []; - }); - } - return loraListPromise; + return api + .fetchApi("/object_info/LoraLoaderModelOnly") + .then((res) => res.json()) + .then( + (info) => info?.LoraLoaderModelOnly?.input?.required?.lora_name?.[0] ?? [] + ) + .catch((err) => { + console.warn("[H3PowerLoraStack] could not fetch lora list", err); + return []; + }); } /**