Skip to content

Commit 832dcdb

Browse files
committed
fix: guard personal-policy expense reports before animation override
1 parent a233517 commit 832dcdb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/hooks/useReportPrimaryAction.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type {ValueOf} from 'type-fest';
22
import {usePaymentAnimationsContext} from '@components/PaymentAnimationsContext';
33
import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
4+
import {isPaidGroupPolicy} from '@libs/PolicyUtils';
45
import {getReportPrimaryAction} from '@libs/ReportPrimaryActionUtils';
6+
import {isExpenseReport as isExpenseReportUtils} from '@libs/ReportUtils';
57
import {isTransactionPendingDelete} from '@libs/TransactionUtils';
68
import CONST from '@src/CONST';
79
import ONYXKEYS from '@src/ONYXKEYS';
@@ -30,6 +32,10 @@ function useReportPrimaryAction(reportID: string | undefined): ValueOf<typeof CO
3032

3133
const isChatReportArchived = useReportIsArchived(chatReport?.reportID);
3234

35+
if (isExpenseReportUtils(moneyRequestReport) && !isPaidGroupPolicy(policy)) {
36+
return '';
37+
}
38+
3339
if (isPaidAnimationRunning || isApprovedAnimationRunning) {
3440
return CONST.REPORT.PRIMARY_ACTIONS.PAY;
3541
}

0 commit comments

Comments
 (0)