Add setting to apply chapter list filters in reader

This commit is contained in:
schroda
2025-07-01 00:37:29 +02:00
parent 21671f3d79
commit 51975ea3cd
13 changed files with 119 additions and 62 deletions

View File

@@ -157,27 +157,25 @@ export class ReaderService {
static useUpdateChapter(): (patch: UpdateChapterPatchInput) => void {
const { manga } = useReaderStateMangaContext();
const { chapterForDuplicatesHandling, currentChapter, mangaChapters } = useReaderStateChaptersContext();
const { currentChapter, mangaChapters, chapters } = useReaderStateChaptersContext();
const { shouldSkipDupChapters } = ReaderService.useSettings();
const {
settings: { deleteChaptersWhileReading, deleteChaptersWithBookmark, updateProgressAfterReading },
} = useMetadataServerSettings();
const previousChapters = useMemo(() => {
if (!chapterForDuplicatesHandling || !currentChapter) {
if (!currentChapter) {
return [];
}
return Chapters.getNextChapters(currentChapter, mangaChapters, {
return Chapters.getNextChapters(currentChapter, chapters, {
offset: DirectionOffset.PREVIOUS,
skipDupe: shouldSkipDupChapters,
skipDupeChapter: chapterForDuplicatesHandling,
});
}, [chapterForDuplicatesHandling?.id, currentChapter?.id, mangaChapters, shouldSkipDupChapters]);
}, [currentChapter?.id, chapters]);
return useCallback(
(patch) => {
if (!manga || !currentChapter) {
if (!manga || !currentChapter || !mangaChapters) {
return;
}