Rename "initialChapter" to "chapterForDuplicatesHandling"

This commit is contained in:
schroda
2025-02-01 20:03:02 +01:00
parent a80e8885fb
commit 91e8b70d35
5 changed files with 21 additions and 20 deletions

View File

@@ -405,7 +405,8 @@ export class ReaderControls {
endReached?: boolean,
) => void {
const { currentPageIndex, setCurrentPageIndex } = userReaderStatePagesContext();
const { initialChapter, currentChapter, nextChapter, mangaChapters } = useReaderStateChaptersContext();
const { chapterForDuplicatesHandling, currentChapter, nextChapter, mangaChapters } =
useReaderStateChaptersContext();
const updateChapter = ReaderService.useUpdateChapter();
const { shouldSkipDupChapters } = ReaderService.useSettings();
const {
@@ -413,16 +414,16 @@ export class ReaderControls {
} = useMetadataServerSettings();
const nextChapters = useMemo(() => {
if (!initialChapter || !currentChapter) {
if (!chapterForDuplicatesHandling || !currentChapter) {
return [];
}
return Chapters.getNextChapters(currentChapter, mangaChapters, {
offset: DirectionOffset.NEXT,
skipDupe: shouldSkipDupChapters,
skipDupeChapter: initialChapter,
skipDupeChapter: chapterForDuplicatesHandling,
});
}, [initialChapter?.id, currentChapter?.id, mangaChapters, shouldSkipDupChapters]);
}, [chapterForDuplicatesHandling?.id, currentChapter?.id, mangaChapters, shouldSkipDupChapters]);
return useCallback(
(pageIndex, debounceChapterUpdate = true, endReached = false) => {

View File

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