Skip to content

Commit

Permalink
Merge pull request #27350 from rezkiy37/fix/27341-split-bill-select-row
Browse files Browse the repository at this point in the history
[CP Staging] Fix OptionRow selection condition

(cherry picked from commit e884a5a)
  • Loading branch information
mountiny authored and OSBotify committed Sep 14, 2023
1 parent e3d0752 commit db7841d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/OptionsList/BaseOptionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,26 @@ function BaseOptionsList({
*/
const renderItem = ({item, index, section}) => {
const isItemDisabled = isDisabled || section.isDisabled || !!item.isDisabled;
const isSelected = _.some(selectedOptions, (option) => {
if (option.accountID === item.accountID) {
return true;
}

if (_.isEmpty(option.name)) {
return false;
}

return option.name === item.searchText;
});

return (
<OptionRow
option={item}
showTitleTooltip={showTitleTooltip}
hoverStyle={optionHoveredStyle}
optionIsFocused={!disableFocusOptions && !isItemDisabled && focusedIndex === index + section.indexOffset}
onSelectRow={onSelectRow}
isSelected={Boolean(_.find(selectedOptions, (option) => option.accountID === item.accountID || option.name === item.searchText))}
isSelected={isSelected}
showSelectedState={canSelectMultipleOptions}
highlightSelected={highlightSelectedOptions}
boldStyle={boldStyle}
Expand Down

0 comments on commit db7841d

Please sign in to comment.