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:
+1
-15
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user