diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-22 09:46:28 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-22 10:35:37 +0100 |
commit | 15bedeebd7671bf5177879899404d48942b2d090 (patch) | |
tree | 6313b11956ea44dd80f409fb2d48f62b11765c13 /client/src/app/shared | |
parent | 94d721efdc9a8c2cda612f49506a41adb6a06f1d (diff) | |
download | PeerTube-15bedeebd7671bf5177879899404d48942b2d090.tar.gz PeerTube-15bedeebd7671bf5177879899404d48942b2d090.tar.zst PeerTube-15bedeebd7671bf5177879899404d48942b2d090.zip |
Fix loading things twice on trending page
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/abstract-video-list.ts | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts index f8abc1656..c13cb3748 100644 --- a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts +++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts | |||
@@ -11,7 +11,7 @@ import { | |||
11 | ViewChild, | 11 | ViewChild, |
12 | ViewContainerRef | 12 | ViewContainerRef |
13 | } from '@angular/core' | 13 | } from '@angular/core' |
14 | import { ActivatedRoute, Router } from '@angular/router' | 14 | import { ActivatedRoute, Params, Router } from '@angular/router' |
15 | import { | 15 | import { |
16 | AuthService, | 16 | AuthService, |
17 | ComponentPaginationLight, | 17 | ComponentPaginationLight, |
@@ -199,6 +199,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte | |||
199 | // No more results | 199 | // No more results |
200 | if (this.lastQueryLength !== undefined && this.lastQueryLength < this.pagination.itemsPerPage) return | 200 | if (this.lastQueryLength !== undefined && this.lastQueryLength < this.pagination.itemsPerPage) return |
201 | 201 | ||
202 | console.log('near of bottom') | ||
202 | this.pagination.currentPage += 1 | 203 | this.pagination.currentPage += 1 |
203 | 204 | ||
204 | this.setScrollRouteParams() | 205 | this.setScrollRouteParams() |
@@ -322,10 +323,17 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte | |||
322 | // On videos hook for children that want to do something | 323 | // On videos hook for children that want to do something |
323 | protected onMoreVideos () { /* empty */ } | 324 | protected onMoreVideos () { /* empty */ } |
324 | 325 | ||
325 | protected loadRouteParams (routeParams: { [ key: string ]: any }) { | 326 | protected load () { /* empty */ } |
326 | this.sort = routeParams[ 'sort' ] as VideoSortField || this.defaultSort | 327 | |
327 | this.categoryOneOf = routeParams[ 'categoryOneOf' ] | 328 | // Hook if the page has custom route params |
328 | this.angularState = routeParams[ 'a-state' ] | 329 | protected loadPageRouteParams (_queryParams: Params) { /* empty */ } |
330 | |||
331 | protected loadRouteParams (queryParams: Params) { | ||
332 | this.sort = queryParams[ 'sort' ] as VideoSortField || this.defaultSort | ||
333 | this.categoryOneOf = queryParams[ 'categoryOneOf' ] | ||
334 | this.angularState = queryParams[ 'a-state' ] | ||
335 | |||
336 | this.loadPageRouteParams(queryParams) | ||
329 | } | 337 | } |
330 | 338 | ||
331 | protected buildLocalFilter (existing: VideoFilter, base: VideoFilter) { | 339 | protected buildLocalFilter (existing: VideoFilter, base: VideoFilter) { |