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

This commit is contained in:
Joseph Milazzo 2021-09-08 18:18:00 -07:00 committed by GitHub
parent f3e006efa2
commit 0f8709dc56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -46,7 +46,8 @@ namespace API.Data.Repositories
VolumeNumber = volume.Number, VolumeNumber = volume.Number,
VolumeId = volume.Id, VolumeId = volume.Id,
chapter.IsSpecial, chapter.IsSpecial,
volume.SeriesId volume.SeriesId,
chapter.Pages
}) })
.Join(_context.Series, data => data.SeriesId, series => series.Id, (data, series) => new .Join(_context.Series, data => data.SeriesId, series => series.Id, (data, series) => new
{ {
@ -55,6 +56,7 @@ namespace API.Data.Repositories
data.VolumeId, data.VolumeId,
data.IsSpecial, data.IsSpecial,
data.SeriesId, data.SeriesId,
data.Pages,
SeriesFormat = series.Format, SeriesFormat = series.Format,
SeriesName = series.Name, SeriesName = series.Name,
series.LibraryId series.LibraryId
@ -68,7 +70,8 @@ namespace API.Data.Repositories
SeriesId =data.SeriesId, SeriesId =data.SeriesId,
SeriesFormat = data.SeriesFormat, SeriesFormat = data.SeriesFormat,
SeriesName = data.SeriesName, SeriesName = data.SeriesName,
LibraryId = data.LibraryId LibraryId = data.LibraryId,
Pages = data.Pages
}) })
.AsNoTracking() .AsNoTracking()
.SingleAsync(); .SingleAsync();

View File

@ -374,7 +374,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.nextChapterDisabled = false; this.nextChapterDisabled = false;
this.prevChapterDisabled = false; this.prevChapterDisabled = false;
this.nextChapterPrefetched = false; this.nextChapterPrefetched = false;
this.pageNum = 1; this.pageNum = 0; // ?! Why was this 1
forkJoin({ forkJoin({
progress: this.readerService.getProgress(this.chapterId), progress: this.readerService.getProgress(this.chapterId),
@ -391,13 +391,17 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.volumeId = results.chapterInfo.volumeId; this.volumeId = results.chapterInfo.volumeId;
this.maxPages = results.chapterInfo.pages; this.maxPages = results.chapterInfo.pages;
console.log('results: ', results);
let page = results.progress.pageNum; let page = results.progress.pageNum;
console.log('page: ', page);
console.log('this.pageNum: ', this.pageNum);
if (page >= this.maxPages) { if (page >= this.maxPages) {
page = this.maxPages - 1; page = this.maxPages - 1;
} }
this.setPageNum(page); this.setPageNum(page);
// Due to change detection rules in Angular, we need to re-create the options object to apply the change // 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); const newOptions: Options = Object.assign({}, this.pageOptions);
newOptions.ceil = this.maxPages - 1; // We -1 so that the slider UI shows us hitting the end, since visually we +1 everything. newOptions.ceil = this.maxPages - 1; // We -1 so that the slider UI shows us hitting the end, since visually we +1 everything.