Skip to content

Commit 7f83bb9

Browse files
authored
Do not use stale chapter data for the reader (#358)
This caused the chapter to be loaded with stale data (the old lastPageRead state) and then jumping to the actual lastPageRead after the latest data was received. It's not possible to mutate the chapter when updating lastPageRead since this causes the reader to always jump back to the just set lastPageRead when scrolling
1 parent 67e554e commit 7f83bb9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/screens/Reader.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export default function Reader() {
107107
const { data: chapter = initialChapter, isLoading: isChapterLoading } = requestManager.useGetChapter(
108108
mangaId,
109109
chapterIndex,
110+
{ disableCache: true },
110111
);
111112
const [wasLastPageReadSet, setWasLastPageReadSet] = useState(false);
112113
const [curPage, setCurPage] = useState<number>(0);
@@ -204,6 +205,7 @@ export default function Reader() {
204205
return;
205206
}
206207

208+
// do not mutate the chapter, this will cause the page to jump around due to always scrolling to the last read page
207209
if (curPage !== -1) {
208210
requestManager.updateChapter(manga.id, chapter.index, { lastPageRead: curPage });
209211
}

0 commit comments

Comments
 (0)