Skip to content

Commit

Permalink
Fix for sorting default value
Browse files Browse the repository at this point in the history
  • Loading branch information
warmans committed Oct 12, 2024
1 parent 4565d12 commit 67f5269
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gui/src/app/module/search/page/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 67f5269

Please sign in to comment.