Skip to content

Commit a638333

Browse files
authored
Handle source browse when first page is also the last page (#436)
In case the first page was also the last page, there is no next page that can be fetched. On large screens, where the initial pages to fetch are 2, this resulted in an endless loading screen
1 parent 529fcf2 commit a638333

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib/requests/RequestManager.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,9 @@ export class RequestManager {
955955
getVariablesFor(0),
956956
);
957957

958-
const areInitialPagesFetched = cachedResults.length >= initialPages;
958+
const areInitialPagesFetched =
959+
cachedResults.length >= initialPages ||
960+
(!!cachedResults.length && !cachedResults[cachedResults.length - 1].data?.fetchSourceManga.hasNextPage);
959961
const isResultForCurrentInput = result?.forInput === JSON.stringify(getVariablesFor(0));
960962
const lastPage = cachedPages.size ? Math.max(...cachedPages) : input.page;
961963
const nextPage = isResultForCurrentInput ? result.size : lastPage;

0 commit comments

Comments
 (0)