Skip to content
Merged
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
21 changes: 16 additions & 5 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -2196,17 +2196,28 @@ function editRegularMoneyRequest(transactionID, transactionThreadReportID, trans
},
},
{
onyxMethod: Onyx.METHOD.SET,
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
value: transaction,
value: {
...transaction,
modifiedCreated: transaction.modifiedCreated ? transaction.modifiedCreated : null,
modifiedAmount: transaction.modifiedAmount ? transaction.modifiedAmount : null,
modifiedCurrency: transaction.modifiedCurrency ? transaction.modifiedCurrency : null,
modifiedMerchant: transaction.modifiedMerchant ? transaction.modifiedMerchant : null,
modifiedWaypoints: transaction.modifiedWaypoints ? transaction.modifiedWaypoints : null,

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.

Can't use null-coalescing (lint)

pendingFields: null,
},
},
{
onyxMethod: Onyx.METHOD.SET,
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`,
value: iouReport,
value: {
...iouReport,
cachedTotal: iouReport.cachedTotal ? iouReport.cachedTotal : null,

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 checked that the policy expense chat request doesn't have cachedTotal optimistically.

lastMessageText and lastMessageHtml turns out is set optimistically in buildOnyxDataForMoneyRequest.

App/src/libs/actions/IOU.js

Lines 279 to 287 in 4239252

onyxMethod: isNewIOUReport ? Onyx.METHOD.SET : Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`,
value: {
...iouReport,
lastMessageText: iouAction.message[0].text,
lastMessageHtml: iouAction.message[0].html,
...(isNewIOUReport ? {pendingFields: {createChat: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD}} : {}),
},
},

},
},
{
onyxMethod: Onyx.METHOD.SET,
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.chatReportID}`,
value: chatReport,
},
Expand Down