mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +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
@@ -190,6 +190,7 @@ export function createNewsLayer({
|
||||
request = null,
|
||||
feedRequest = null,
|
||||
inViewRequest = null,
|
||||
inViewRequestKey = null,
|
||||
areaRequest = null,
|
||||
settleTimer = null,
|
||||
pulseTimer = null,
|
||||
@@ -958,7 +959,9 @@ export function createNewsLayer({
|
||||
// clears it, not only the next refresh.
|
||||
needs = { ...needs, conflicts: null };
|
||||
feed = {
|
||||
...mergeFeedPage(feed, page, mode, now(), undefined, windowMs),
|
||||
// Kept for the server's whole window (the shown one filters the
|
||||
// view), so the rows between the head and the cursor are never lost.
|
||||
...mergeFeedPage(feed, page, mode, now(), undefined, maxWindowMs),
|
||||
loading: false,
|
||||
error: null,
|
||||
};
|
||||
@@ -1039,18 +1042,24 @@ export function createNewsLayer({
|
||||
// The section changed, or the layer went off, while the area was read.
|
||||
if (!local() || !enabled) return;
|
||||
const readKey = inView.area?.key ?? '';
|
||||
if (
|
||||
!force &&
|
||||
inView.readKey === readKey &&
|
||||
(inView.minor || inViewRequest)
|
||||
) {
|
||||
const held = inView.readKey === readKey && inView.minor;
|
||||
if (!force && (inViewRequest ? inViewRequestKey === readKey : held)) {
|
||||
render();
|
||||
notify();
|
||||
return;
|
||||
}
|
||||
// A read still out for another area must not land over this one.
|
||||
inViewRequest?.abort();
|
||||
if (!force && held) {
|
||||
inViewRequest = null;
|
||||
inView = { ...inView, loading: false };
|
||||
render();
|
||||
notify();
|
||||
return;
|
||||
}
|
||||
const controller = new AbortController();
|
||||
inViewRequest = controller;
|
||||
inViewRequestKey = readKey;
|
||||
inView = { ...inView, loading: true };
|
||||
notify();
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user