diff options
author | Chocobozzz <me@florianbigard.com> | 2023-02-24 15:05:59 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-02-24 15:05:59 +0100 |
commit | 09a7ce0c60d3e98eedf58f245bf2aaba9837785b (patch) | |
tree | efc7ce9ace486660ef572ff3c6e8d02bb2891a58 /client/src/app | |
parent | 700e24197a261966369b5357239aa93f429478d7 (diff) | |
download | PeerTube-09a7ce0c60d3e98eedf58f245bf2aaba9837785b.tar.gz PeerTube-09a7ce0c60d3e98eedf58f245bf2aaba9837785b.tar.zst PeerTube-09a7ce0c60d3e98eedf58f245bf2aaba9837785b.zip |
Fix infinite scroll on search page
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/+search/search.component.html | 2 | ||||
-rw-r--r-- | client/src/app/+search/search.component.ts | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/client/src/app/+search/search.component.html b/client/src/app/+search/search.component.html index 37da67005..c07dbab08 100644 --- a/client/src/app/+search/search.component.html +++ b/client/src/app/+search/search.component.html | |||
@@ -1,4 +1,4 @@ | |||
1 | <div myInfiniteScroller (nearOfBottom)="onNearOfBottom()" class="search-result"> | 1 | <div myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onSearchDataSubject.asObservable()" class="search-result"> |
2 | <div class="results-header"> | 2 | <div class="results-header"> |
3 | <div class="first-line"> | 3 | <div class="first-line"> |
4 | <div class="results-counter" *ngIf="pagination.totalItems"> | 4 | <div class="results-counter" *ngIf="pagination.totalItems"> |
diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts index 366fbd459..31394a1d1 100644 --- a/client/src/app/+search/search.component.ts +++ b/client/src/app/+search/search.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { forkJoin, Subscription } from 'rxjs' | 1 | import { forkJoin, Subject, Subscription } from 'rxjs' |
2 | import { LinkType } from 'src/types/link.type' | 2 | import { LinkType } from 'src/types/link.type' |
3 | import { Component, OnDestroy, OnInit } from '@angular/core' | 3 | import { Component, OnDestroy, OnInit } from '@angular/core' |
4 | import { ActivatedRoute, Router } from '@angular/router' | 4 | import { ActivatedRoute, Router } from '@angular/router' |
@@ -44,6 +44,8 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
44 | 44 | ||
45 | userMiniature: User | 45 | userMiniature: User |
46 | 46 | ||
47 | onSearchDataSubject = new Subject<any>() | ||
48 | |||
47 | private subActivatedRoute: Subscription | 49 | private subActivatedRoute: Subscription |
48 | private isInitialLoad = false // set to false to show the search filters on first arrival | 50 | private isInitialLoad = false // set to false to show the search filters on first arrival |
49 | 51 | ||
@@ -147,6 +149,8 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
147 | this.lastSearchTarget = this.advancedSearch.searchTarget | 149 | this.lastSearchTarget = this.advancedSearch.searchTarget |
148 | 150 | ||
149 | this.hasMoreResults = this.results.length < this.pagination.totalItems | 151 | this.hasMoreResults = this.results.length < this.pagination.totalItems |
152 | |||
153 | this.onSearchDataSubject.next(results) | ||
150 | }, | 154 | }, |
151 | 155 | ||
152 | error: err => { | 156 | error: err => { |