Skip to content

Commit

Permalink
Merge pull request #35770 from s77rt/OptionsList-keyForList
Browse files Browse the repository at this point in the history
Use keyForList in OptionsSelector's isSelected logic
  • Loading branch information
Hayata Suenaga authored Feb 4, 2024
2 parents 49eb35b + c90b767 commit 0ae07be
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 0ae07be

Please sign in to comment.