Lists open at once from what the page keeps and fetches ahead, or with a spinner (#247)
A click on a feed, All Subscriptions or a filter fetched the list and only then drew it, so nothing answered the click until the server did. The page now keeps the first page of each list (the newest 40, by view, filter, sort and search), draws a kept one at once and refreshes it behind, drawing again only if it changed. It fetches ahead: All Subscriptions and the twenty feeds with the most unread once the page is idle, two at a time, and a feed or filter when the pointer or a finger reaches it. A feed_row or a read forgets that feed's lists and All Subscriptions'; the forgotten are fetched again behind. A list with nothing kept shows a spinner if its answer takes more than 120 ms. list_shown (#246) is reported when the list first shows, so a kept one reports its few ms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,8 @@ function connect(){
|
||||
const refreshEntries=soon(()=>{ if(S.feed) loadEntries(false,true).catch(()=>{}); });
|
||||
// Every scan's events reach everyone; only this person's feeds are theirs to show or refresh.
|
||||
const mine=(id: string)=>S.feeds.some(f=>f.id===id);
|
||||
// The lists a change made stale, fetched again behind, once a burst of rows has passed (#247).
|
||||
const preloadSoon=soon(preloadLists,2000);
|
||||
sse.onmessage=m=>{
|
||||
let ev; try{ ev=JSON.parse(m.data) }catch{ return }
|
||||
if(ev.ev==='progress'){
|
||||
@@ -61,7 +63,7 @@ function connect(){
|
||||
else if(ev.ev==='feed_error') setScanning(ev.feed,false);
|
||||
// The server sends a feed's new row after anything changes it (counts, error, last check),
|
||||
// only to those who subscribe; the page used to reload the whole list after each event.
|
||||
else if(ev.ev==='feed_row') patchFeed(ev.row);
|
||||
else if(ev.ev==='feed_row'){ patchFeed(ev.row); forgetLists(ev.row.id); preloadSoon(); }
|
||||
// Only a scan that checked something: the scheduler scans every minute, due or not, and
|
||||
// every open page reloaded the whole list each time (#103).
|
||||
// Rows came as feed_row events. ponytail: a feed an OPML drops stays in the list until the
|
||||
@@ -73,4 +75,4 @@ function connect(){
|
||||
sse.onerror=()=>{ sse.close(); dropped=true; setTimeout(connect,4000); };
|
||||
}
|
||||
connect();
|
||||
loadFeeds().catch(()=>{});
|
||||
loadFeeds().then(preloadLists).catch(()=>{});
|
||||
|
||||
Reference in New Issue
Block a user