Chapters download menu download ahead only if required

Instead of checking if download ahead is required because not enough unread downloaded chapters existed, it just downloaded the next n unread undownloaded chapters
This commit is contained in:
schroda
2024-04-20 02:40:10 +02:00
parent 52e077ff19
commit b1f97fdf69
2 changed files with 23 additions and 14 deletions

View File

@@ -34,8 +34,9 @@ export const ChaptersDownloadActionMenuItems = ({
settings: { downloadAheadLimit },
} = useMetadataServerSettings();
const handleSelect = (size?: number, onlyUnread: boolean = true) => {
const handleSelect = (size?: number, onlyUnread: boolean = true, downloadAhead: boolean = false) => {
Mangas.performAction('download', mangaIds, {
downloadAhead,
onlyUnread,
size,
}).catch(defaultPromiseErrorHandler('ChapterDownloadButton::handleSelect'));
@@ -56,7 +57,7 @@ export const ChaptersDownloadActionMenuItems = ({
<MenuItem onClick={() => handleSelect(DownloadRange.NEXT_25)}>
{t('chapter.action.download.add.label.next_twentyfive')}
</MenuItem>
<MenuItem onClick={() => handleSelect(downloadAheadLimit)}>
<MenuItem onClick={() => handleSelect(downloadAheadLimit, undefined, true)}>
{t('chapter.action.download.add.label.ahead', { count: downloadAheadLimit })}
</MenuItem>
<MenuItem onClick={() => handleSelect(DownloadRange.UNREAD)}>