Skip to content
Open
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
13 changes: 11 additions & 2 deletions src/hooks/useLifecycleActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,24 @@ function useLifecycleActions({reportID, startApprovedAnimation, startAnimation,
CONST.IOU.REPORT_ACTION_TYPE.PAY,
() => {
startAnimation();
markReportPaymentReceived(chatReport, moneyRequestReport, accountID, email ?? '', chatReportActions, isTrackIntentUser, getCurrencyDecimals);
markReportPaymentReceived(
chatReport,
moneyRequestReport,
accountID,
email ?? '',
chatReportActions,
isTrackIntentUser,
allTransactionViolations,
getCurrencyDecimals,
);
},
CONST.IOU.PAYMENT_TYPE.ELSEWHERE,
);
return;
}

startAnimation();
markReportPaymentReceived(chatReport, moneyRequestReport, accountID, email ?? '', chatReportActions, isTrackIntentUser, getCurrencyDecimals);
markReportPaymentReceived(chatReport, moneyRequestReport, accountID, email ?? '', chatReportActions, isTrackIntentUser, allTransactionViolations, getCurrencyDecimals);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Read violations after the confirmation resolves

When transaction violations change after the user selects Received payment but before they confirm the modal, this async handler still passes the collection snapshot captured by the earlier render. Previously markReportPaymentReceived() read the current collection when it executed; now hasOutstandingChildRequest() can persist an incorrect value for sibling reports, and the success data does not refresh that chat flag. The held-expense callback has the same issue because it may execute even later.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

},
},
[CONST.REPORT.SECONDARY_ACTIONS.UNAPPROVE]: {
Expand Down
4 changes: 1 addition & 3 deletions src/libs/actions/IOU/PayMoneyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -960,14 +960,12 @@ function markReportPaymentReceived(
currentUserEmail: string,
chatReportActions: OnyxEntry<OnyxTypes.ReportActions>,
isTrackIntentUser: boolean | undefined,
allTransactionViolations: OnyxCollection<OnyxTypes.TransactionViolations>,
getCurrencyDecimals: CurrencyListActionsContextType['getCurrencyDecimals'],
) {
if (!chatReport || !iouReport) {
return;
}
// TODO: https://github.com/Expensify/App/issues/66512
// eslint-disable-next-line @typescript-eslint/no-deprecated
const allTransactionViolations = getAllTransactionViolations();
const recipient = {accountID: iouReport.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID};
const total = getReimbursableTotal(iouReport);
const optimisticIOUReportAction = buildOptimisticIOUReportAction({
Expand Down
Loading
Loading