Skip to content

Commit

Permalink
refactor(search-filters-summary): ignore 'any' via ignoreList
Browse files Browse the repository at this point in the history
  • Loading branch information
tkohr committed Dec 16, 2024
1 parent 5e4ba39 commit dca5437
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export class SearchFiltersSummaryComponent implements OnInit {
@Inject(FILTER_SUMMARY_IGNORE_LIST)
filterSummaryIgnoreList: string[]
) {
this.filterSummaryIgnoreList = filterSummaryIgnoreList || []
const defaultIgnoreList = ['any']
this.filterSummaryIgnoreList = [
...defaultIgnoreList,
...(filterSummaryIgnoreList ?? []),
]
}

ngOnInit(): void {
Expand All @@ -47,7 +51,6 @@ export class SearchFiltersSummaryComponent implements OnInit {
filteredFilters[key] = value
}
}
delete filteredFilters['any'] //ignore search field
return Object.values(filteredFilters).some(
(value) =>
value !== undefined &&
Expand All @@ -63,7 +66,7 @@ export class SearchFiltersSummaryComponent implements OnInit {
map((filters) => {
const newFilters = { ...filters }
Object.keys(newFilters).forEach((key) => {
if (!this.filterSummaryIgnoreList.includes(key) && key !== 'any') {
if (!this.filterSummaryIgnoreList.includes(key)) {
delete newFilters[key]
}
})
Expand Down

0 comments on commit dca5437

Please sign in to comment.