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:
parent
e6314be92d
commit
e472075087
1 changed files with 6 additions and 1 deletions
|
|
@ -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 ────────────────────────────────
|
||||
|
|
|
|||
Loading…
Reference in a new issue