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

(cherry picked from commit 0ae07be)
  • Loading branch information
Hayata Suenaga authored and OSBotify committed Feb 5, 2024
1 parent 016bbbc commit 62fcca7
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 @@ -52,6 +52,7 @@ type PayeePersonalDetails = {
descriptiveText: string;
login: string;
accountID: number;
keyForList: string;
};

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

Expand Down

0 comments on commit 62fcca7

Please sign in to comment.