Skip to content

Commit ea1bf86

Browse files
committed
fix(data): clear refreshing when an earlier page errors and retry it on loadMore
When a non-last page expired and its reload failed, holes stayed true (the page was not ready and not last), so refreshing never cleared. loadMore only inspected the last page, leaving no recovery path. - Only set holes for pending (actively loading) non-last pages, not errored ones, so refreshing correctly reflects in-flight loads. - Have loadMore retry the earliest errored page before looking at the last, so a failed earlier page recovers on the next loadMore call.
1 parent 3a2748e commit ea1bf86

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎packages/octane/src/data/pages.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ function createPages<P, T>(
8585
let snapshot: PagesSnapshot<T> | null = null;
8686

8787
function loadMore(): Promise<void> {
88+
for (let i = 0; i < pages.length - 1; i++) {
89+
if (pages[i]!.getSnapshot().status === 'error') return pages[i]!.refresh();
90+
}
8891
const last = pages[pages.length - 1]!;
8992
const state = last.getSnapshot();
9093
if (state.status === 'error') return last.refresh();
@@ -107,7 +110,7 @@ function createPages<P, T>(
107110
// its own rows out: the pages after it are still current.
108111
for (const part of current) {
109112
if (part.status === 'ready') rows.push(...part.value!);
110-
else if (part !== last) holes = true;
113+
else if (part !== last && part.status === 'pending') holes = true;
111114
}
112115
const ready = current.some((part) => part.status === 'ready');
113116
snapshot = {

0 commit comments

Comments
 (0)