fix(library): evict stale thumb URL on image load error, re-observe for retry

When a signed S3 URL expires the img fires onerror. Previously the stale URL
stayed in thumbCache so the broken image would persist. Now we delete the cache
entry, clear the loaded class, and re-add the element to the IntersectionObserver
so the next time it scrolls into view a fresh signed URL is fetched.
This commit is contained in:
Zac Gaetano 2026-05-18 23:46:12 -04:00
parent e6314be92d
commit e472075087

View file

@ -541,7 +541,12 @@
function setImgSrc(img, src) {
img.src = src;
img.onload = () => img.classList.add('loaded');
img.onload = () => img.classList.add('loaded');
img.onerror = () => {
delete state.thumbCache[img.dataset.assetId];
img.classList.remove('loaded');
thumbObserver.observe(img);
};
}
// ── Init ────────────────────────────────