From f22ac9f17b399bcc2e3934e4f70dd155e5eaf6d3 Mon Sep 17 00:00:00 2001 From: situchan Date: Sun, 24 Sep 2023 22:01:53 +0600 Subject: [PATCH] fix crash on category picker --- src/components/CategoryPicker/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;