Feature/gql remove download ahead limit (#608)

* Use new "autoDownloadNewChaptersLimit" setting

* Use "downloadAheadLimit" from metadata

Should have been changed with 2acf2b6d33
This commit is contained in:
schroda
2024-02-17 20:24:02 +01:00
committed by GitHub
parent fd651b6165
commit e5ffbb462c
4 changed files with 20 additions and 16 deletions

View File

@@ -106,8 +106,10 @@ export function Reader() {
const { data: chapterData, loading: isChapterLoading } = requestManager.useGetMangaChapter(mangaId, chapterIndex);
const arePagesUpdatedRef = useRef(false);
const { data: settingsData } = requestManager.useGetServerSettings();
const isDownloadAheadEnabled = !!settingsData?.settings.autoDownloadAheadLimit;
const {
settings: { downloadAheadLimit },
} = useMetadataServerSettings();
const isDownloadAheadEnabled = !!downloadAheadLimit;
const getLoadedChapter = () => {
const isAChapterLoaded = loadedChapter.current;
@@ -234,7 +236,7 @@ export function Reader() {
const chapterIdsToDownload = nextChaptersUpToDate
// "settingsData" can't be undefined since this would not get executed otherwise
.slice(-settingsData!.settings.autoDownloadAheadLimit)
.slice(-downloadAheadLimit)
.filter((mangaChapter) => !mangaChapter.isDownloaded)
.map((mangaChapter) => mangaChapter.id)
.filter((id) => !Chapters.isDownloading(id));