]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix infinite scroll on search page
authorChocobozzz <me@florianbigard.com>
Fri, 24 Feb 2023 14:05:59 +0000 (15:05 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 24 Feb 2023 14:05:59 +0000 (15:05 +0100)
client/src/app/+search/search.component.html
client/src/app/+search/search.component.ts

index 37da67005393a8e4b8399b90d1b06e0e219567f1..c07dbab082b76dc5edb944a572c355d462a3a5af 100644 (file)
@@ -1,4 +1,4 @@
-<div myInfiniteScroller (nearOfBottom)="onNearOfBottom()" class="search-result">
+<div myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onSearchDataSubject.asObservable()" class="search-result">
   <div class="results-header">
     <div class="first-line">
       <div class="results-counter" *ngIf="pagination.totalItems">
index 366fbd459906b293f085fabb2cbb533b3ae41543..31394a1d14cb366dcd88b86cfe292e7be35cdff6 100644 (file)
@@ -1,4 +1,4 @@
-import { forkJoin, Subscription } from 'rxjs'
+import { forkJoin, Subject, Subscription } from 'rxjs'
 import { LinkType } from 'src/types/link.type'
 import { Component, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
@@ -44,6 +44,8 @@ export class SearchComponent implements OnInit, OnDestroy {
 
   userMiniature: User
 
+  onSearchDataSubject = new Subject<any>()
+
   private subActivatedRoute: Subscription
   private isInitialLoad = false // set to false to show the search filters on first arrival
 
@@ -147,6 +149,8 @@ export class SearchComponent implements OnInit, OnDestroy {
         this.lastSearchTarget = this.advancedSearch.searchTarget
 
         this.hasMoreResults = this.results.length < this.pagination.totalItems
+
+        this.onSearchDataSubject.next(results)
       },
 
       error: err => {