From 68727ae16cb95276ce1781b9ca46a1116a60caef Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 13 Sep 2023 16:55:53 +0200 Subject: [PATCH] simplify --- src/components/OptionsList/BaseOptionsList.js | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/components/OptionsList/BaseOptionsList.js b/src/components/OptionsList/BaseOptionsList.js index 1e936df11f98..47efa1a5ac9e 100644 --- a/src/components/OptionsList/BaseOptionsList.js +++ b/src/components/OptionsList/BaseOptionsList.js @@ -170,19 +170,17 @@ function BaseOptionsList({ */ const renderItem = ({item, index, section}) => { const isItemDisabled = isDisabled || section.isDisabled || !!item.isDisabled; - const isSelected = Boolean( - _.find(selectedOptions, (option) => { - if (option.accountID === item.accountID) { - return true; - } + const isSelected = _.some(selectedOptions, (option) => { + if (option.accountID === item.accountID) { + return true; + } - if (_.isEmpty(option.name)) { - return false; - } + if (_.isEmpty(option.name)) { + return false; + } - return option.name === item.searchText; - }), - ); + return option.name === item.searchText; + }); return (