diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 8fd0ff73d334..6a54af6849c2 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -240,7 +240,7 @@ function removeMembers(accountIDs, policyID) { key: membersListKey, value: _.object(accountIDs, Array(accountIDs.length).fill({errors: ErrorUtils.getMicroSecondOnyxError('workspace.people.error.genericRemove')})), }, - ..._.map(workspaceChats, ({reportID, stateNum, statusNum, hasDraft, oldPolicyName}) => ({ + ..._.map(workspaceChats, ({reportID, stateNum, statusNum, hasDraft, oldPolicyName = null}) => ({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, value: { @@ -250,6 +250,11 @@ function removeMembers(accountIDs, policyID) { oldPolicyName, }, })), + ..._.map(optimisticClosedReportActions, (reportAction, index) => ({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${workspaceChats[index].reportID}`, + value: {[reportAction.reportActionID]: null}, + })), ]; API.write( 'DeleteMembersFromWorkspace',