Skip to content

Commit 78ff4d0

Browse files
committed
Shorten getReportFromHoldRequestsOnyxData totals-update comment per review
1 parent d0f3d83 commit 78ff4d0

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/libs/actions/IOU/Hold.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,12 +816,9 @@ function getReportFromHoldRequestsOnyxData({
816816

817817
const isApprovalEnabled = policy ? policy.approvalMode && policy.approvalMode !== CONST.POLICY.APPROVAL_MODE.OPTIONAL : false;
818818

819-
// After the held transactions are reassigned to the new hold report, the original iouReport
820-
// only contains the previously-unheld transactions. Its total/nonReimbursableTotal must be
821-
// updated optimistically so that offline consumers (e.g. the Pay button label computed from
822-
// report.total via getMoneyRequestSpendBreakdown) reflect the new remaining amount instead
823-
// of the stale pre-move total. unheldTotal is intentionally left unchanged because it already
824-
// equals the new total once all remaining transactions on this report are unheld.
819+
// Held transactions just moved out, leaving total/nonReimbursableTotal stale on this report —
820+
// offline consumers (e.g. the Pay button) would read the wrong amount until server reconciles.
821+
// unheldTotal stays as-is: every remaining transaction is unheld, so it already equals the new total.
825822
const shouldUpdateOriginalReportTotals = holdTransactions.length > 0 && iouReport?.unheldTotal !== undefined;
826823

827824
const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS | typeof ONYXKEYS.COLLECTION.TRANSACTION>> = [

0 commit comments

Comments
 (0)