The refresh buttons keep turning between one feed and the next (#231)

A scan checks its feeds one at a time; in the gap between two the body class came off, the
icon snapped back upright and the spin restarted, many times a second with fetches ahead.
The class now comes off only after 600 ms with nothing being checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 14:49:55 +00:00
parent 8d7a30d1f9
commit 7ecbe8293f
2 changed files with 15 additions and 2 deletions

View File

@@ -51,8 +51,17 @@ function paintScanning(){
// The refresh buttons turn while what they check is being checked (#78). On <body>, because
// a feed's page is redrawn as its items come in and would take a class on the button with it.
const busy=id=>scanning.has(id)||S.feeds.some(c=>c.group===id&&scanning.has(c.id));
document.body.classList.toggle('scan-this',busy(S.feed));
document.body.classList.toggle('scan-any',S.feeds.some(f=>scanning.has(f.id)));
spin('scan-this',busy(S.feed));
spin('scan-any',S.feeds.some(f=>scanning.has(f.id)));
}
/// Starts a refresh button turning at once, and stops it only after a moment with nothing being
/// checked: a scan takes its feeds one at a time, and in the gap between two the class came off,
/// the icon snapped back upright and started again, many times a second.
const spinStop: Record<string, number>={};
function spin(cls: string, on: boolean){
clearTimeout(spinStop[cls]);
if(on) document.body.classList.add(cls);
else spinStop[cls]=setTimeout(()=>document.body.classList.remove(cls),600);
}
function renderFeeds(){