Handle empty arrays too.

This commit is contained in:
Sam Rose 2024-10-23 15:13:58 +01:00
parent ca0dc030ad
commit 9ebd890c04
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -135,17 +135,19 @@ export function isSupportedUserSearch(query: SearchFilters) {
return false
}
}
return true
}
export function processSearchFilters(filterArray: undefined): undefined
export function processSearchFilters(filterArray: []): undefined
export function processSearchFilters(
filterArray: LegacyFilter[]
): Required<UISearchFilter>
export function processSearchFilters(
filterArray?: LegacyFilter[]
): Required<UISearchFilter> | undefined {
if (!filterArray) {
if (!filterArray || filterArray.length === 0) {
return undefined
}
const { allOr, onEmptyFilter, filters } = splitFiltersArray(filterArray)