Skip to content

Commit

Permalink
Use keyForList in OptionsSelector's isSelected logic
Browse files Browse the repository at this point in the history
  • Loading branch information
s77rt committed Feb 4, 2024
1 parent 3ab4e6e commit c90b767
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 1 addition & 9 deletions src/components/OptionsList/BaseOptionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,7 @@ function BaseOptionsList(
const renderItem: SectionListRenderItem<OptionData, Section> = ({item, index, section}) => {
const isItemDisabled = isDisabled || !!section.isDisabled || !!item.isDisabled;
const isSelected = selectedOptions?.some((option) => {
if (option.accountID && option.accountID === item.accountID) {
return true;
}

if (option.reportID && option.reportID === item.reportID) {
return true;
}

if (option.policyID && option.policyID === item.policyID) {
if (option.keyForList && option.keyForList === item.keyForList) {
return true;
}

Expand Down
2 changes: 2 additions & 0 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type PayeePersonalDetails = {
descriptiveText: string;
login: string;
accountID: number;
keyForList: string;
};

type CategorySection = {
Expand Down Expand Up @@ -1737,6 +1738,7 @@ function getIOUConfirmationOptionsFromPayeePersonalDetail(personalDetail: Person
descriptiveText: amountText,
login: personalDetail.login ?? '',
accountID: personalDetail.accountID,
keyForList: String(personalDetail.accountID),
};
}

Expand Down

0 comments on commit c90b767

Please sign in to comment.