Fix: Prevent premature rendering while movies load
This commit is contained in:
parent
971d6dd48f
commit
cf2eae1752
2 changed files with 10 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
<section>
|
||||
@if (movies.length > 0) {
|
||||
<div *ngIf="isLoading"></div>
|
||||
@if (!isLoading && movies.length > 0) {
|
||||
<!-- If at least one film has been uploaded -->
|
||||
@if (playMovie === "") {
|
||||
<app-header
|
||||
|
|
@ -95,7 +96,7 @@
|
|||
</div>
|
||||
<app-video-player [playMovie]="playMovie"></app-video-player>
|
||||
</div>
|
||||
} } @else {
|
||||
} } @if (!isLoading && movies.length === 0) {
|
||||
<!-- If the database is empty -->
|
||||
<app-header [browse]="true"></app-header>
|
||||
<div class="error">
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export class BrowseComponent implements OnInit {
|
|||
favoriteMovies: number[] = [];
|
||||
currentMovie: any[] = [];
|
||||
playMovie: string = '';
|
||||
isLoading: boolean = true;
|
||||
isWideScreen: boolean = false;
|
||||
uploadMovieOverview: boolean = false;
|
||||
currentResolution: '360p' | '720p' | '1080p' = '720p';
|
||||
|
|
@ -104,7 +105,12 @@ export class BrowseComponent implements OnInit {
|
|||
}
|
||||
|
||||
async loadAllMovies() {
|
||||
this.movies = await this.movieService.getAllMovies();
|
||||
this.isLoading = true;
|
||||
try {
|
||||
this.movies = await this.movieService.getAllMovies();
|
||||
} finally {
|
||||
this.isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
closeVideo(): void {
|
||||
|
|
|
|||
Loading…
Reference in a new issue