mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 08:00:06 +00:00
fix(admin): the phone release history no longer skips a page after a long prerelease run
When five full pages in a row held only prereleases, the walk stopped with its page counter already one past the last page it read, so the next Load more started a page later and that page of releases never showed. The counter now ends on the last page read.
This commit is contained in:
@@ -73,12 +73,13 @@ export function useGithubReleases({ isPrerelease, fillPages = false }: UseGithub
|
||||
let more = true;
|
||||
|
||||
for (let i = 0; i < MAX_PAGES_PER_LOAD; i++) {
|
||||
// Step on only when another page follows, so `page` ends on the last one read.
|
||||
if (i > 0) pageNum += 1;
|
||||
const data = await fetchPage(pageNum);
|
||||
if (!data) return;
|
||||
collected.push(...data);
|
||||
more = data.length === PER_PAGE;
|
||||
if (!more || collected.some(isShown)) break;
|
||||
pageNum += 1;
|
||||
}
|
||||
|
||||
setReleases((prev) => (append ? [...prev, ...collected] : collected));
|
||||
|
||||
Reference in New Issue
Block a user