diff --git a/src/components/CategoryPicker/index.js b/src/components/CategoryPicker/index.js index ee591a851c13..ef8b1d71ad1d 100644 --- a/src/components/CategoryPicker/index.js +++ b/src/components/CategoryPicker/index.js @@ -54,13 +54,13 @@ function CategoryPicker({selectedCategory, policyCategories, policyRecentlyUsedC let categoryInitialFocusedIndex = 0; if (!_.isEmpty(searchValue) || isCategoriesCountBelowThreshold) { - const index = _.findIndex(lodashGet(sections, '[0].data', []), (category) => category.searchText === iou.category); + const index = _.findIndex(lodashGet(sections, '[0].data', []), (category) => category.searchText === selectedCategory); categoryInitialFocusedIndex = index === -1 ? 0 : index; } return categoryInitialFocusedIndex; - }, [iou.category, searchValue, isCategoriesCountBelowThreshold, sections]); + }, [selectedCategory, searchValue, isCategoriesCountBelowThreshold, sections]); const headerMessage = OptionsListUtils.getHeaderMessage(lodashGet(sections, '[0].data.length', 0) > 0, false, searchValue); const shouldShowTextInput = !isCategoriesCountBelowThreshold;