Always live-scan Studio 2 LoRAs on load and Refresh like Settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-18 12:59:06 -05:00
co-authored by Cursor
parent 7221b6a8cf
commit b194b3cefa
4 changed files with 36 additions and 27 deletions
+2 -3
View File
@@ -1,11 +1,10 @@
export async function cachedLoras({read,write,live,fresh=false}) {
export async function cachedLoras({read,write,live,fresh: _fresh=false}) {
const cached=read() || {image:[],video:[]};
if (!fresh && (cached.image?.length || cached.video?.length)) return cached;
try {
// Always live-scan. Disk is asleep/empty fallback only — never a stale snapshot that skips Comfy.
const listed=await live();
const image=Array.isArray(listed?.image)?listed.image:[];
const video=Array.isArray(listed?.video)?listed.video:[];
// Comfy asleep / empty: keep disk. Otherwise replace — never merge stale names that freeze adds.
if (!image.length && !video.length) return cached;
const next={image,video};
write(next);