Skip to content

Commit e884a5a

Browse files
authored
Merge pull request #27350 from rezkiy37/fix/27341-split-bill-select-row
[CP Staging] Fix OptionRow selection condition
2 parents d68263a + 68727ae commit e884a5a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/components/OptionsList/BaseOptionsList.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,26 @@ function BaseOptionsList({
170170
*/
171171
const renderItem = ({item, index, section}) => {
172172
const isItemDisabled = isDisabled || section.isDisabled || !!item.isDisabled;
173+
const isSelected = _.some(selectedOptions, (option) => {
174+
if (option.accountID === item.accountID) {
175+
return true;
176+
}
177+
178+
if (_.isEmpty(option.name)) {
179+
return false;
180+
}
181+
182+
return option.name === item.searchText;
183+
});
184+
173185
return (
174186
<OptionRow
175187
option={item}
176188
showTitleTooltip={showTitleTooltip}
177189
hoverStyle={optionHoveredStyle}
178190
optionIsFocused={!disableFocusOptions && !isItemDisabled && focusedIndex === index + section.indexOffset}
179191
onSelectRow={onSelectRow}
180-
isSelected={Boolean(_.find(selectedOptions, (option) => option.accountID === item.accountID || option.name === item.searchText))}
192+
isSelected={isSelected}
181193
showSelectedState={canSelectMultipleOptions}
182194
highlightSelected={highlightSelectedOptions}
183195
boldStyle={boldStyle}

0 commit comments

Comments
 (0)