From c88593f72f1097cc34a091b4cb4b6d6e214d1e9f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 29 Jan 2018 09:30:06 +0100 Subject: Fix search pagination --- client/src/app/videos/video-list/video-search.component.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'client/src/app/videos/video-list/video-search.component.ts') diff --git a/client/src/app/videos/video-list/video-search.component.ts b/client/src/app/videos/video-list/video-search.component.ts index b7556c13e..67726afdc 100644 --- a/client/src/app/videos/video-list/video-search.component.ts +++ b/client/src/app/videos/video-list/video-search.component.ts @@ -16,7 +16,9 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O currentRoute = '/videos/search' loadOnInit = false - private search = '' + protected otherParams = { + search: '' + } private subActivatedRoute: Subscription constructor (protected router: Router, @@ -32,7 +34,10 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O this.subActivatedRoute = this.route.queryParams.subscribe( queryParams => { - this.search = queryParams['search'] + const querySearch = queryParams['search'] + if (!querySearch || this.otherParams.search === querySearch) return + + this.otherParams.search = querySearch this.reloadVideos() }, @@ -47,6 +52,6 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O } getVideosObservable () { - return this.videoService.searchVideos(this.search, this.pagination, this.sort) + return this.videoService.searchVideos(this.otherParams.search, this.pagination, this.sort) } } -- cgit v1.2.3