aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/search/search.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/search/search.component.ts')
-rw-r--r--client/src/app/search/search.component.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts
index 4c540ca72..475fdd277 100644
--- a/client/src/app/search/search.component.ts
+++ b/client/src/app/search/search.component.ts
@@ -31,6 +31,7 @@ export class SearchComponent implements OnInit, OnDestroy {
31 31
32 private subActivatedRoute: Subscription 32 private subActivatedRoute: Subscription
33 private isInitialLoad = true 33 private isInitialLoad = true
34 private firstSearch = true
34 35
35 private channelsPerPage = 2 36 private channelsPerPage = 2
36 37
@@ -103,13 +104,16 @@ export class SearchComponent implements OnInit, OnDestroy {
103 .concat(videosResult.videos) 104 .concat(videosResult.videos)
104 this.pagination.totalItems = videosResult.totalVideos + videoChannelsResult.total 105 this.pagination.totalItems = videosResult.totalVideos + videoChannelsResult.total
105 106
106 // Focus on channels 107 // Focus on channels if there are no enough videos
107 if (this.channelsPerPage !== 10 && videosResult.videos.length < this.pagination.itemsPerPage) { 108 if (this.firstSearch === true && videosResult.videos.length < this.pagination.itemsPerPage) {
108 this.resetPagination() 109 this.resetPagination()
110 this.firstSearch = false
109 111
110 this.channelsPerPage = 10 112 this.channelsPerPage = 10
111 this.search() 113 this.search()
112 } 114 }
115
116 this.firstSearch = false
113 }, 117 },
114 118
115 error => { 119 error => {