mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
fix(discover): 🐛 Fixed up the discover lists,
Handle the exception from using the internal API, improve the loading so it shouldn't 'step back'. Also fixed where it would only load a small number of items and wouldn't load any more
This commit is contained in:
parent
99c728918e
commit
fc69158597
1 changed files with 12 additions and 6 deletions
|
@ -144,7 +144,7 @@ export class CarouselListComponent implements OnInit {
|
||||||
let currentIteration = 0;
|
let currentIteration = 0;
|
||||||
while (this.discoverResults.length <= 14 && currentIteration <= 3) {
|
while (this.discoverResults.length <= 14 && currentIteration <= 3) {
|
||||||
currentIteration++;
|
currentIteration++;
|
||||||
await this.loadData();
|
await this.loadData(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,11 @@ export class CarouselListComponent implements OnInit {
|
||||||
public async newPage() {
|
public async newPage() {
|
||||||
// Note this is using the internal carousel APIs
|
// Note this is using the internal carousel APIs
|
||||||
// https://github.com/primefaces/primeng/blob/master/src/app/components/carousel/carousel.ts
|
// https://github.com/primefaces/primeng/blob/master/src/app/components/carousel/carousel.ts
|
||||||
var end = this.carousel._page >= (this.carousel.totalDots() - 1);
|
if (!this.carousel?.page) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var end = this.carousel.page >= (this.carousel.totalDots() - 2) || this.carousel.totalDots() === 1;
|
||||||
if (end) {
|
if (end) {
|
||||||
var moviePromise: Promise<void>;
|
var moviePromise: Promise<void>;
|
||||||
var tvPromise: Promise<void>;
|
var tvPromise: Promise<void>;
|
||||||
|
@ -178,7 +182,7 @@ export class CarouselListComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async loadData() {
|
private async loadData(clearExisting: boolean = true) {
|
||||||
var moviePromise: Promise<void>;
|
var moviePromise: Promise<void>;
|
||||||
var tvPromise: Promise<void>;
|
var tvPromise: Promise<void>;
|
||||||
switch (+this.discoverOptions) {
|
switch (+this.discoverOptions) {
|
||||||
|
@ -195,7 +199,7 @@ export class CarouselListComponent implements OnInit {
|
||||||
}
|
}
|
||||||
await moviePromise;
|
await moviePromise;
|
||||||
await tvPromise;
|
await tvPromise;
|
||||||
this.createInitialModel();
|
this.createInitialModel(clearExisting);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async switchDiscoverMode(newMode: DiscoverOption) {
|
private async switchDiscoverMode(newMode: DiscoverOption) {
|
||||||
|
@ -250,8 +254,10 @@ export class CarouselListComponent implements OnInit {
|
||||||
this.currentlyLoaded += this.amountToLoad;
|
this.currentlyLoaded += this.amountToLoad;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createInitialModel() {
|
private createInitialModel(clearExisting: boolean = true) {
|
||||||
this.clear();
|
if (clearExisting) {
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
this.createModel();
|
this.createModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue