Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature/gql remove download ahead limit #608

Merged
merged 2 commits into from
Feb 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use "downloadAheadLimit" from metadata
Should have been changed with 2acf2b6
schroda committed Feb 17, 2024
commit 321d656bcc79695e0e06b26c2e47b6b568f45e48
8 changes: 5 additions & 3 deletions src/screens/Reader.tsx
Original file line number Diff line number Diff line change
@@ -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));