Skip to content

Commit

Permalink
Prevent unnecessary chapter updated due to restoring last read page (#…
Browse files Browse the repository at this point in the history
…621)

When resuming a chapter and restoring the last read page, a chapter update was send for the just restored page
  • Loading branch information
schroda authored Mar 1, 2024
1 parent 90b6c3a commit c538af4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/screens/Reader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ export function Reader() {
return;
}

const chapterUpToDate = Chapters.getFromCache<TChapter>(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;
Expand Down

0 comments on commit c538af4

Please sign in to comment.