From ac3ffe3fb2d3d3fece48fd9fb11eb6d13484fbef Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Fri, 15 Sep 2023 14:26:46 +0200 Subject: [PATCH 1/3] ref: migrate ReportActions to TS --- .../actions/{ReportActions.js => ReportActions.ts} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename src/libs/actions/{ReportActions.js => ReportActions.ts} (86%) diff --git a/src/libs/actions/ReportActions.js b/src/libs/actions/ReportActions.ts similarity index 86% rename from src/libs/actions/ReportActions.js rename to src/libs/actions/ReportActions.ts index d270876840ac..9a1e27b010cd 100644 --- a/src/libs/actions/ReportActions.js +++ b/src/libs/actions/ReportActions.ts @@ -3,14 +3,14 @@ import ONYXKEYS from '../../ONYXKEYS'; import CONST from '../../CONST'; import * as ReportActionUtils from '../ReportActionsUtils'; import * as ReportUtils from '../ReportUtils'; +import {ReportAction} from '../../types/onyx'; -/** - * @param {String} reportID - * @param {Object} reportAction - */ -function clearReportActionErrors(reportID, reportAction) { +function clearReportActionErrors(reportID: string, reportAction: ReportAction) { const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction); + if (!reportAction.reportActionID) { + return; + } if (reportAction.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { // Delete the optimistic action Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${originalReportID}`, { From 68c2c92147fece7f5c314123ad683edf825d3ee9 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 18 Sep 2023 15:51:57 +0200 Subject: [PATCH 2/3] ref: resolve comment --- src/libs/actions/ReportActions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/ReportActions.ts b/src/libs/actions/ReportActions.ts index 9a1e27b010cd..3db23e5c9af7 100644 --- a/src/libs/actions/ReportActions.ts +++ b/src/libs/actions/ReportActions.ts @@ -11,6 +11,7 @@ function clearReportActionErrors(reportID: string, reportAction: ReportAction) { if (!reportAction.reportActionID) { return; } + if (reportAction.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { // Delete the optimistic action Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${originalReportID}`, { From 805aca90639d27658265f708fb63e4dafa51a2f0 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Wed, 20 Sep 2023 12:47:36 +0200 Subject: [PATCH 3/3] fix: resolve comment --- src/libs/actions/ReportActions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/ReportActions.ts b/src/libs/actions/ReportActions.ts index 3db23e5c9af7..3faa1dbe3574 100644 --- a/src/libs/actions/ReportActions.ts +++ b/src/libs/actions/ReportActions.ts @@ -3,7 +3,7 @@ import ONYXKEYS from '../../ONYXKEYS'; import CONST from '../../CONST'; import * as ReportActionUtils from '../ReportActionsUtils'; import * as ReportUtils from '../ReportUtils'; -import {ReportAction} from '../../types/onyx'; +import ReportAction from '../../types/onyx/ReportAction'; function clearReportActionErrors(reportID: string, reportAction: ReportAction) { const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction);