diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 30accf449368..977770e08ad1 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -964,12 +964,17 @@ function getCategoryListSections( } if (searchInputValue) { - const searchCategories = enabledCategories - .filter((category) => category.name.toLowerCase().includes(searchInputValue.toLowerCase())) - .map((category) => ({ + const searchCategories: Category[] = []; + + enabledCategories.forEach((category) => { + if (!category.name.toLowerCase().includes(searchInputValue.toLowerCase())) { + return; + } + searchCategories.push({ ...category, isSelected: selectedOptions.some((selectedOption) => selectedOption.name === category.name), - })); + }); + }); categorySections.push({ // "Search" section