Skip to content

Commit

Permalink
Merge pull request #22746 from samh-nl/fix/issue-22060
Browse files Browse the repository at this point in the history
fix: clear task pendingAction upon success
  • Loading branch information
luacmartins authored Jul 13, 2023
2 parents 138a41c + 4f49a47 commit a5f6467
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions src/libs/actions/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,17 @@ function completeTask(taskReportID, taskTitle) {
},
];

const successData = [];
const successData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
value: {
[completedTaskReportAction.reportActionID]: {
pendingAction: null,
},
},
},
];
const failureData = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -273,7 +283,17 @@ function reopenTask(taskReportID, taskTitle) {
},
];

const successData = [];
const successData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
value: {
[reopenedTaskReportAction.reportActionID]: {
pendingAction: null,
},
},
},
];
const failureData = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -613,6 +633,18 @@ function cancelTask(taskReportID, taskTitle, originalStateNum, originalStatusNum
},
];

const successData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
value: {
[optimisticReportActionID]: {
pendingAction: null,
},
},
},
];

const failureData = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand All @@ -631,7 +663,7 @@ function cancelTask(taskReportID, taskTitle, originalStateNum, originalStatusNum
},
];

API.write('CancelTask', {cancelledTaskReportActionID: optimisticReportActionID, taskReportID}, {optimisticData, failureData});
API.write('CancelTask', {cancelledTaskReportActionID: optimisticReportActionID, taskReportID}, {optimisticData, successData, failureData});
}

/**
Expand Down

0 comments on commit a5f6467

Please sign in to comment.