Make sure processSearchFilters handles an undefined input.

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

View File

@ -138,9 +138,16 @@ export function isSupportedUserSearch(query: SearchFilters) {
return true return true
} }
export const processSearchFilters = ( export function processSearchFilters(filterArray: undefined): undefined
export function processSearchFilters(
filterArray: LegacyFilter[] filterArray: LegacyFilter[]
): Required<UISearchFilter> => { ): Required<UISearchFilter>
export function processSearchFilters(
filterArray?: LegacyFilter[]
): Required<UISearchFilter> | undefined {
if (!filterArray) {
return undefined
}
const { allOr, onEmptyFilter, filters } = splitFiltersArray(filterArray) const { allOr, onEmptyFilter, filters } = splitFiltersArray(filterArray)
return { return {
logicalOperator: UILogicalOperator.ALL, logicalOperator: UILogicalOperator.ALL,