Skip to content

Commit 0df7bc6

Browse files
committed
show highlighting only when we have dependent tags
1 parent 1fe09f7 commit 0df7bc6

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/components/ReportActionItem/MoneyRequestView.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {convertToDisplayString} from '@libs/CurrencyUtils';
2727
import DistanceRequestUtils from '@libs/DistanceRequestUtils';
2828
import {isReceiptError} from '@libs/ErrorUtils';
2929
import {hasEnabledOptions} from '@libs/OptionsListUtils';
30-
import {getTagLists, hasDependentTags, isTaxTrackingEnabled} from '@libs/PolicyUtils';
30+
import {getTagLists, hasDependentTags as hasDependentTagsPolicyUtils, isTaxTrackingEnabled} from '@libs/PolicyUtils';
3131
import {getThumbnailAndImageURIs} from '@libs/ReceiptUtils';
3232
import {getOriginalMessage, isMoneyRequestAction, isPayAction} from '@libs/ReportActionsUtils';
3333
import {
@@ -461,11 +461,12 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals
461461
...(transaction?.errorFields?.route ?? transaction?.errorFields?.waypoints ?? transaction?.errors),
462462
...parentReportAction?.errors,
463463
};
464+
const hasDependentTags = hasDependentTagsPolicyUtils(policy, policyTagList);
464465

465466
const tagList = policyTagLists.map(({name, orderWeight, tags}, index) => {
466467
const tagForDisplay = getTagForDisplay(updatedTransaction ?? transaction, index);
467468
let shouldShow = false;
468-
if (hasDependentTags(policy, policyTagList)) {
469+
if (hasDependentTags) {
469470
if (index === 0) {
470471
shouldShow = true;
471472
} else {
@@ -486,7 +487,7 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals
486487
tagListIndex: index,
487488
tagListName: name,
488489
},
489-
hasDependentTags(policy, policyTagList),
490+
hasDependentTags,
490491
tagForDisplay,
491492
);
492493

@@ -496,7 +497,7 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals
496497
pendingAction={getPendingFieldAction('tag')}
497498
>
498499
<MenuItemWithTopDescription
499-
highlighted={shouldShow && !getTagForDisplay(transaction, index)}
500+
highlighted={hasDependentTags && shouldShow && !getTagForDisplay(transaction, index)}
500501
description={name ?? translate('common.tag')}
501502
title={tagForDisplay}
502503
numberOfLinesTitle={2}

0 commit comments

Comments
 (0)