From c538af4462b1ebf3a8894da408fb651fae6101ea Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Fri, 1 Mar 2024 01:17:03 +0100 Subject: [PATCH] Prevent unnecessary chapter updated due to restoring last read page (#621) When resuming a chapter and restoring the last read page, a chapter update was send for the just restored page --- src/screens/Reader.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/screens/Reader.tsx b/src/screens/Reader.tsx index b2c3a524..da660fef 100644 --- a/src/screens/Reader.tsx +++ b/src/screens/Reader.tsx @@ -355,6 +355,11 @@ export function Reader() { return; } + const chapterUpToDate = Chapters.getFromCache(chapter.id); + if (curPageDebounced === chapterUpToDate?.lastPageRead) { + return; + } + // do not mutate the chapter, this will cause the page to jump around due to always scrolling to the last read page const updateLastPageRead = curPageDebounced !== -1; const updateIsRead = curPageDebounced === chapter.pageCount - 1;