]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/search/search.component.ts
add theming via css custom properties
[github/Chocobozzz/PeerTube.git] / client / src / app / search / search.component.ts
index 4c540ca72b2b467d57affba42ad2a36ece9e592a..475fdd277628469bf1a821097612367edd3da591 100644 (file)
@@ -31,6 +31,7 @@ export class SearchComponent implements OnInit, OnDestroy {
 
   private subActivatedRoute: Subscription
   private isInitialLoad = true
+  private firstSearch = true
 
   private channelsPerPage = 2
 
@@ -103,13 +104,16 @@ export class SearchComponent implements OnInit, OnDestroy {
                              .concat(videosResult.videos)
           this.pagination.totalItems = videosResult.totalVideos + videoChannelsResult.total
 
-          // Focus on channels
-          if (this.channelsPerPage !== 10 && videosResult.videos.length < this.pagination.itemsPerPage) {
+          // Focus on channels if there are no enough videos
+          if (this.firstSearch === true && videosResult.videos.length < this.pagination.itemsPerPage) {
             this.resetPagination()
+            this.firstSearch = false
 
             this.channelsPerPage = 10
             this.search()
           }
+
+          this.firstSearch = false
         },
 
         error => {