From 03df893e34216327e8bbfa6aa454ca43075bcb4c Mon Sep 17 00:00:00 2001 From: spark Date: Sat, 17 Oct 2026 14:03:29 +0000 Subject: [PATCH] Library: keep the grid loading reliably and never show a silent blank tile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two causes of the "half-loaded" grid where some READY photos stay grey: 1. cachedImage fetched thumbnails with no timeout, inside a 6-slot concurrency limiter. A single stalled request (busy server, dropped connection) held its slot forever and starved every queued tile, so the rest of the grid never loaded. Download now runs through an AbortController that aborts after 20s, freeing the slot so the queue keeps moving; the stalled photo falls back to loading its URL directly instead of blocking the others. 2. The grid cell rendered `shown && ` with no onError and no fallback, so a pending or failed image was an indistinguishable grey blank. A READY photo now shows "…" while its thumbnail is still resolving and "erro" if the image fails to load (onError), mirroring the loupe's resilience. UI/cache only; no API or data changes. Claude-Session: https://claude.ai/code/session_01RAkmwWv6L5KmpX4h9JPD2i --- apps/app/src/library/Grid.tsx | 10 +++++++++- apps/app/src/offline/cache.ts | 16 +++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/apps/app/src/library/Grid.tsx b/apps/app/src/library/Grid.tsx index f85d65d..3797519 100644 --- a/apps/app/src/library/Grid.tsx +++ b/apps/app/src/library/Grid.tsx @@ -31,6 +31,8 @@ const Cell = memo(function Cell({ photo, index, src, selected, focused, onPick, const label = LABEL_COLOR[photo.colorLabel]; // Desktop app: thumbnails are kept on the computer, so the grid shows without a network. const shown = useCachedImage(src, isDesktop()); + const [imgFailed, setImgFailed] = useState(false); + useEffect(() => setImgFailed(false), [shown]); return (