mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(news): keep the feed cursor in step with the list and drop Local reads for an area left
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
1 parent
7cd2af46e4
commit
fd9373c09c
4 files changed
+142
-6
No files matched your search
@@ -617,6 +617,8 @@ export function reportMarkerPosition(report, pin = 0) {
|
||||
* only the window and at most `max` rows (a long session does not grow
|
||||
* the list). `mode` 'head' refreshes the top and keeps the older cursor;
|
||||
* 'append' adds an older page and takes its cursor; 'replace' starts over.
|
||||
* A head page that has older pages behind it and shares no row with the list
|
||||
* left a gap (more than a page arrived since), so it starts over too.
|
||||
*/
|
||||
export function mergeFeedPage(
|
||||
feed,
|
||||
@@ -627,6 +629,10 @@ export function mergeFeedPage(
|
||||
windowMs = NEWS_WINDOW_MS,
|
||||
) {
|
||||
const byId = new Map();
|
||||
if (mode === 'head' && page.nextBefore && feed.items.length) {
|
||||
const held = new Set(feed.items.map((item) => item.id));
|
||||
if (!page.reports.some((item) => held.has(item.id))) mode = 'replace';
|
||||
}
|
||||
const items =
|
||||
mode === 'replace'
|
||||
? page.reports
|
||||
|
||||
Reference in new issue
Block a user