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
This commit is contained in:
schroda
2024-03-01 01:17:03 +01:00
committed by GitHub
parent 90b6c3a0fa
commit c538af4462

View File

@@ -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;