Skip to content

Commit

Permalink
Merge pull request #3734 from Expensify/clem-fix-sequence-number
Browse files Browse the repository at this point in the history
Send the sequenceNumber when deleting a report comment
  • Loading branch information
robertjchen authored Jun 23, 2021
2 parents ad41508 + afd5447 commit 8f8d835
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1073,9 +1073,10 @@ function addAction(reportID, text, file) {
*/
function deleteReportComment(reportID, reportAction) {
// Optimistic Response
const sequenceNumber = reportAction.sequenceNumber;
const reportActionsToMerge = {};
const oldMessage = {...reportAction.message};
reportActionsToMerge[reportAction.sequenceNumber] = {
reportActionsToMerge[sequenceNumber] = {
...reportAction,
message: [
{
Expand All @@ -1093,11 +1094,12 @@ function deleteReportComment(reportID, reportAction) {
reportID,
reportActionID: reportAction.reportActionID,
reportComment: '',
sequenceNumber,
})
.then((response) => {
if (response.jsonCode !== 200) {
// Reverse Optimistic Response
reportActionsToMerge[reportAction.sequenceNumber] = {
reportActionsToMerge[sequenceNumber] = {
...reportAction,
message: oldMessage,
};
Expand Down

0 comments on commit 8f8d835

Please sign in to comment.