Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Fixed an issue from perf tuning where I forgot to send Pages to frontend, breaking reader. (#569)

Joseph Milazzo0f8709dc565e
diff --git a/API/Data/Repositories/ChapterRepository.cs b/API/Data/Repositories/ChapterRepository.cs
index 3ea93b776..0b7acaeab 100644
--- a/API/Data/Repositories/ChapterRepository.cs
+++ b/API/Data/Repositories/ChapterRepository.cs
@@ -46,7 +46,8 @@ namespace API.Data.Repositories
VolumeNumber = volume.Number,
VolumeId = volume.Id,
chapter.IsSpecial,
- volume.SeriesId
+ volume.SeriesId,
+ chapter.Pages
})
.Join(_context.Series, data => data.SeriesId, series => series.Id, (data, series) => new
{
@@ -55,6 +56,7 @@ namespace API.Data.Repositories
data.VolumeId,
data.IsSpecial,
data.SeriesId,
+ data.Pages,
SeriesFormat = series.Format,
SeriesName = series.Name,
series.LibraryId
@@ -68,7 +70,8 @@ namespace API.Data.Repositories
SeriesId =data.SeriesId,
SeriesFormat = data.SeriesFormat,
SeriesName = data.SeriesName,
- LibraryId = data.LibraryId
+ LibraryId = data.LibraryId,
+ Pages = data.Pages
})
.AsNoTracking()
.SingleAsync();
diff --git a/UI/Web/src/app/manga-reader/manga-reader.component.ts b/UI/Web/src/app/manga-reader/manga-reader.component.ts
index c348acb42..fd9176d1b 100644
--- a/UI/Web/src/app/manga-reader/manga-reader.component.ts
+++ b/UI/Web/src/app/manga-reader/manga-reader.component.ts
@@ -374,7 +374,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.nextChapterDisabled = false;
this.prevChapterDisabled = false;
this.nextChapterPrefetched = false;
- this.pageNum = 1;
+ this.pageNum = 0; // ?! Why was this 1
forkJoin({
progress: this.readerService.getProgress(this.chapterId),
@@ -391,12 +391,16 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.volumeId = results.chapterInfo.volumeId;
this.maxPages = results.chapterInfo.pages;
-
+ console.log('results: ', results);
let page = results.progress.pageNum;
+ console.log('page: ', page);
+ console.log('this.pageNum: ', this.pageNum);
if (page >= this.maxPages) {
page = this.maxPages - 1;
}
this.setPageNum(page);
+
+
// Due to change detection rules in Angular, we need to re-create the options object to apply the change
const newOptions: Options = Object.assign({}, this.pageOptions);