From 67f5269672c9eab31f27b48bb01ee87b91e9494b Mon Sep 17 00:00:00 2001 From: warmans <> Date: Sat, 12 Oct 2024 18:22:43 +0100 Subject: [PATCH] Fix for sorting default value --- .../app/module/search/page/search/search.component.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gui/src/app/module/search/page/search/search.component.ts b/gui/src/app/module/search/page/search/search.component.ts index c5d89d25..e08b5582 100644 --- a/gui/src/app/module/search/page/search/search.component.ts +++ b/gui/src/app/module/search/page/search/search.component.ts @@ -46,7 +46,9 @@ export class SearchComponent implements OnInit, OnDestroy { private router: Router) { this.currentSorting.valueChanges.pipe(takeUntil(this.unsubscribe$)).subscribe((val) => { - console.log("VAL", val); + if (!val) { + return; + } this.router.navigate([], { queryParams: { sort: val @@ -58,7 +60,10 @@ export class SearchComponent implements OnInit, OnDestroy { route.queryParamMap.pipe(takeUntil(this.unsubscribe$)).subscribe((params: ParamMap) => { this.currentPage = parseInt(params.get('page'), 10) || 0; - this.currentSorting.setValue((params.get('sort') || '').trim()); + let sorting = (params.get('sort') || '').trim(); + if (sorting) { + this.currentSorting.setValue(sorting); + } this.query = (params.get('q') || '').trim(); if (this.query === '') { this.result = null;