Skip to content

Commit 19b7eb2

Browse files
committed
Update
1 parent 2f11253 commit 19b7eb2

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/components/MoneyRequestConfirmationList.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -650,12 +650,15 @@ function MoneyRequestConfirmationList({
650650
useEffect(() => {
651651
let updatedTagsString = TransactionUtils.getTag(transaction);
652652
policyTagLists.forEach((tagList, index) => {
653-
const enabledTags = Object.values(tagList.tags).filter((tag) => tag.enabled);
654653
const isTagListRequired = tagList.required ?? false;
655-
if (!isTagListRequired || enabledTags.length !== 1 || TransactionUtils.getTag(transaction, index)) {
654+
if (!isTagListRequired) {
655+
return;
656+
}
657+
const enabledTags = Object.values(tagList.tags).filter((tag) => tag.enabled);
658+
if (enabledTags.length !== 1 || TransactionUtils.getTag(transaction, index)) {
656659
return;
657660
}
658-
updatedTagsString = IOUUtils.insertTagIntoTransactionTagsString(updatedTagsString, enabledTags[0] ? enabledTags[0].name : '', index);
661+
updatedTagsString = IOUUtils.insertTagIntoTransactionTagsString(updatedTagsString, enabledTags.at(0)?.name ?? '', index);
659662
});
660663
if (updatedTagsString !== TransactionUtils.getTag(transaction) && updatedTagsString) {
661664
IOU.setMoneyRequestTag(transactionID, updatedTagsString);

src/libs/OptionsListUtils.ts

-4
Original file line numberDiff line numberDiff line change
@@ -1353,10 +1353,6 @@ function getTagListSections(
13531353
* Verifies that there is at least one enabled tag
13541354
*/
13551355
function hasEnabledTags(policyTagList: Array<PolicyTagList[keyof PolicyTagList]>) {
1356-
if (!policyTagList) {
1357-
return false;
1358-
}
1359-
13601356
const policyTagValueList = policyTagList
13611357
.filter(tag => tag && tag.tags)
13621358
.map(({tags}) => Object.values(tags))

0 commit comments

Comments
 (0)