Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update lastActorAccountID for transactionThread #36219

Merged
Changes from 2 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
19 changes: 18 additions & 1 deletion src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,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 @@ -1119,6 +1119,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 @@ -1197,6 +1205,15 @@ function getUpdateMoneyRequestParams(
});
}

if (transactionThread) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we add the same if statement for the optimistic above? Looks like the optimistic data exists always, but failure has a condition.

// 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
Loading