From 7ecbe8293f53fcf4a25b06703aa94dddb4bcc2f0 Mon Sep 17 00:00:00 2001 From: rays Date: Wed, 14 Oct 2026 14:49:55 +0000 Subject: [PATCH] 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 --- web/CHANGELOG.md | 4 ++++ web/src/feeds.ts | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/web/CHANGELOG.md b/web/CHANGELOG.md index a6620e9..15716d9 100644 --- a/web/CHANGELOG.md +++ b/web/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- The check-every-feed button turns smoothly through a scan instead of jerking back upright between one feed and the next (#231). + ## [1.0.1] - 2026-10-13 ### Fixed diff --git a/web/src/feeds.ts b/web/src/feeds.ts index 9145180..9be3deb 100644 --- a/web/src/feeds.ts +++ b/web/src/feeds.ts @@ -51,8 +51,17 @@ function paintScanning(){ // The refresh buttons turn while what they check is being checked (#78). On , 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={}; +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(){