Stop deleted LoRAs from sticking in the picker.

A cache merge that preferred the longer list was keeping removed files forever. Fresh Comfy lists now replace the cache, including shrinks, and xiagen- typos stay off AIGen like xaigen-.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-04 21:45:31 -05:00
co-authored by Cursor
parent d50719e1a7
commit b481c4e3ad
3 changed files with 14 additions and 22 deletions
+1 -15
View File
@@ -166,24 +166,10 @@ async function loadLoraCache(options: { fresh?: boolean } = {}): Promise<LoraCac
}
// Comfy asleep / unreachable returns empty. Keep the last good list so the picker
// does not vanish — but do NOT refresh `at`, or a blip freezes new folder drops out.
// Never merge a shorter fresh list back into the old one: deletes must disappear.
if (!next.image.length && !next.video.length && cache && (cache.image.length || cache.video.length)) {
return cache
}
// Prefer the richer list when a partial reply would shrink a known catalog.
if (
cache
&& (next.image.length + next.video.length) < (cache.image.length + cache.video.length)
&& next.image.every(name => cache!.image.includes(name) || cache!.video.includes(name))
&& next.video.every(name => cache!.image.includes(name) || cache!.video.includes(name))
) {
const merged: LoraCache = {
at: Date.now(),
image: uniqueNames([...cache.image, ...next.image]),
video: uniqueNames([...cache.video, ...next.video])
}
cache = merged
return merged
}
cache = next
return next
})().finally(() => {