Skip to content

Commit

Permalink
Merge pull request #36219 from koko57/refactor/34411-lhn-previews-fol…
Browse files Browse the repository at this point in the history
…lowup-offline-displayname
  • Loading branch information
blimpich authored Feb 12, 2024
2 parents 944b20f + 3703efd commit bbadfcc
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ function getUpdateMoneyRequestParams(
});
}

// Optimistically modify the transaction
// Optimistically modify the transaction and the transaction thread
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
Expand All @@ -1140,6 +1140,14 @@ function getUpdateMoneyRequestParams(
},
});

optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`,
value: {
lastActorAccountID: updatedReportAction.actorAccountID,
},
});

if (isScanning && ('amount' in transactionChanges || 'currency' in transactionChanges)) {
optimisticData.push(
{
Expand Down Expand Up @@ -1237,6 +1245,13 @@ function getUpdateMoneyRequestParams(
});
}

// Reset the transaction thread to its original state
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`,
value: transactionThread,
});

return {
params,
onyxData: {optimisticData, successData, failureData},
Expand Down

0 comments on commit bbadfcc

Please sign in to comment.