Skip to content

Commit

Permalink
fix(sortby): avoid null value from sortBy$ observable
Browse files Browse the repository at this point in the history
  • Loading branch information
fgravin committed Aug 25, 2023
1 parent a09a3fb commit 07c78fe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libs/feature/search/src/lib/sort-by/sort-by.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { marker } from '@biesbjerg/ngx-translate-extract-marker'
import { SortByEnum, SortByField } from '@geonetwork-ui/common/domain/search'
import { SearchFacade } from '../state/search.facade'
import { SearchService } from '../utils/service/search.service'
import { map } from 'rxjs/operators'
import { filter, map } from 'rxjs/operators'

@Component({
selector: 'gn-ui-sort-by',
Expand All @@ -24,7 +24,10 @@ export class SortByComponent {
value: SortByEnum.POPULARITY.join(','),
},
]
currentSortBy$ = this.facade.sortBy$.pipe(map((sortBy) => sortBy.join(',')))
currentSortBy$ = this.facade.sortBy$.pipe(
filter((sortBy) => !!sortBy),
map((sortBy) => sortBy.join(','))
)

constructor(
private facade: SearchFacade,
Expand Down

0 comments on commit 07c78fe

Please sign in to comment.