Screenshots: Refresh retries every failed preview, even if a background check lands meanwhile

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-30 20:32:28 +10:00
1 parent 6cf01729e2
commit f2c8466ba9
1 file changed
+2 -1
+2 -1
View File
@@ -3596,9 +3596,10 @@ async function readShots(quiet) {
// tried again on Refresh, not by every background check. // tried again on Refresh, not by every background check.
async function fillThumbs(quiet) { async function fillThumbs(quiet) {
const run = ++shots.fill; const run = ++shots.fill;
// Refresh puts every failed one back in line first, so a background pass that takes over carries them all on.
if (!quiet) for (const img of document.querySelectorAll("#shotGrid img[data-failed]")) delete img.dataset.failed;
for (const img of document.querySelectorAll("#shotGrid img[data-shot]:not([src])" + (quiet ? ":not([data-failed])" : ""))) { for (const img of document.querySelectorAll("#shotGrid img[data-shot]:not([src])" + (quiet ? ":not([data-failed])" : ""))) {
const s = shots.list[+img.dataset.shot]; const s = shots.list[+img.dataset.shot];
delete img.dataset.failed; // being tried again, so a background pass taking over keeps it
let url; let url;
try { url = await shotThumb(s.id); } catch (e) { img.alt = "Preview failed"; img.dataset.failed = 1; } try { url = await shotThumb(s.id); } catch (e) { img.alt = "Preview failed"; img.dataset.failed = 1; }
if (run !== shots.fill) return; // a newer pass (after a check, a redraw or another headset) has taken over if (run !== shots.fill) return; // a newer pass (after a check, a redraw or another headset) has taken over