+ return Object.keys(this._selection).some(k => this._selection[k] === true)
+ }
+
+ videoById (index: number, video: Video) {
+ return video.id
+ }
+
+ onNearOfBottom () {
+ if (this.disabled) return
+
+ // No more results
+ if (this.lastQueryLength !== undefined && this.lastQueryLength < this.pagination.itemsPerPage) return
+
+ this.pagination.currentPage += 1
+
+ this.loadMoreVideos()
+ }
+
+ loadMoreVideos (reset = false) {
+ if (reset) this.hasDoneFirstQuery = false
+
+ this.getVideosObservable(this.pagination.currentPage)
+ .subscribe({
+ next: ({ data }) => {
+ this.hasDoneFirstQuery = true
+ this.lastQueryLength = data.length
+
+ if (reset) this.videos = []
+ this.videos = this.videos.concat(data)
+ this.videosModel = this.videos
+
+ this.onDataSubject.next(data)
+ },
+
+ error: err => {
+ const message = $localize`Cannot load more videos. Try again later.`
+
+ logger.error(message, err)
+ this.notifier.error(message)
+ }
+ })