From 7f83bb9a0a9413d5b469025d82baf7198e36451f Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Thu, 8 Jun 2023 13:46:55 +0200 Subject: [PATCH] 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 --- src/screens/Reader.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/screens/Reader.tsx b/src/screens/Reader.tsx index acc695cb..3410dbbb 100644 --- a/src/screens/Reader.tsx +++ b/src/screens/Reader.tsx @@ -107,6 +107,7 @@ export default function Reader() { const { data: chapter = initialChapter, isLoading: isChapterLoading } = requestManager.useGetChapter( mangaId, chapterIndex, + { disableCache: true }, ); const [wasLastPageReadSet, setWasLastPageReadSet] = useState(false); const [curPage, setCurPage] = useState(0); @@ -204,6 +205,7 @@ export default function Reader() { return; } + // do not mutate the chapter, this will cause the page to jump around due to always scrolling to the last read page if (curPage !== -1) { requestManager.updateChapter(manga.id, chapter.index, { lastPageRead: curPage }); }