Skip to content
6 changes: 3 additions & 3 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -1894,17 +1894,17 @@ function editMoneyRequest(transactionID, transactionThreadReportID, transactionC
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
value: transaction,
},
{
onyxMethod: Onyx.METHOD.MERGE,
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`,
value: iouReport,
},
{
onyxMethod: Onyx.METHOD.MERGE,
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.chatReportID}`,
value: chatReport,
},
Comment on lines 1897 to 1910

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 am not 100% sure this is the best practice, but from this it seems fine to me to use SET

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.

MERGE merges both previous and the new data. In this case however, we're generating new optimistic objects for transaction, iouReport and chatReport. As such, it makes sense to use SET directly.

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.

This change caused regression.

Issue -> "IOU - Edited amount for a paid request does not revert to initial amount after closing error message"

Expand Down
Loading