Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,12 @@ function MoneyReportHeader({
isChatReportArchived,
invoiceReceiverPolicy,
isPaidAnimationRunning,
isApprovedAnimationRunning,
isSubmittingAnimationRunning,
});
}, [
isPaidAnimationRunning,
isApprovedAnimationRunning,
isSubmittingAnimationRunning,
moneyRequestReport,
chatReport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,21 @@ function MoneyRequestReportPreviewContent({
transactions,
invoiceReceiverPolicy,
isPaidAnimationRunning,
isApprovedAnimationRunning,
isSubmittingAnimationRunning,
);
}, [isPaidAnimationRunning, isSubmittingAnimationRunning, violations, iouReport, policy, transactions, isIouReportArchived, invoiceReceiverPolicy, isChatReportArchived]);
}, [
isPaidAnimationRunning,
isApprovedAnimationRunning,
isSubmittingAnimationRunning,
violations,
iouReport,
policy,
transactions,
isIouReportArchived,
invoiceReceiverPolicy,
isChatReportArchived,
]);

const addExpenseDropdownOptions = useMemo(
() => [
Expand Down
5 changes: 4 additions & 1 deletion src/libs/ReportPreviewActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,16 @@ function getReportPreviewAction(
transactions?: Transaction[],
invoiceReceiverPolicy?: Policy,
isPaidAnimationRunning?: boolean,
isApprovedAnimationRunning?: boolean,
isSubmittingAnimationRunning?: boolean,
): ValueOf<typeof CONST.REPORT.REPORT_PREVIEW_ACTIONS> {
if (!report) {
return CONST.REPORT.REPORT_PREVIEW_ACTIONS.VIEW;
}

if (isPaidAnimationRunning) {
// We want to have action displayed for either paid or approved animations
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if (isPaidAnimationRunning || isApprovedAnimationRunning) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate on why we don't use ?? here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this logic from the previous code, so don't have much context here, but i think the issue here is that both the values above are booleans and not strings so my guess is that ?? won't work here, if you think we should try with ?? lmk i can work on this later today

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Let keep previous code then.

return CONST.REPORT.REPORT_PREVIEW_ACTIONS.PAY;
}

Expand Down
6 changes: 5 additions & 1 deletion src/libs/ReportPrimaryActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type GetReportPrimaryActionParams = {
isChatReportArchived: boolean;
invoiceReceiverPolicy?: Policy;
isPaidAnimationRunning?: boolean;
isApprovedAnimationRunning?: boolean;
isSubmittingAnimationRunning?: boolean;
};

Expand Down Expand Up @@ -333,10 +334,13 @@ function getReportPrimaryAction(params: GetReportPrimaryActionParams): ValueOf<t
chatReport,
invoiceReceiverPolicy,
isPaidAnimationRunning,
isApprovedAnimationRunning,
isSubmittingAnimationRunning,
} = params;

if (isPaidAnimationRunning) {
// We want to have action displayed for either paid or approved animations
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if (isPaidAnimationRunning || isApprovedAnimationRunning) {
return CONST.REPORT.PRIMARY_ACTIONS.PAY;
}
if (isSubmittingAnimationRunning) {
Expand Down
Loading