From 8ac36259aaf804091fc1862faecda344b61e77b2 Mon Sep 17 00:00:00 2001 From: Pavlo Tsimura Date: Fri, 15 Dec 2023 17:40:04 +0100 Subject: [PATCH 1/2] Revert the use of SET operation --- src/libs/actions/IOU.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 7513989d08c4..b7fa45c3769d 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -925,13 +925,11 @@ function getUpdateMoneyRequestParams(transactionID, transactionThreadReportID, t } // Optimistically modify the transaction - const optimisticTransaction = onlyIncludeChangedFields ? _.pick(updatedTransaction, _.keys(transactionChanges)) : updatedTransaction; optimisticData.push({ - // We need to use SET method to save updated waypoint instead MERGE method to avoid wrong update of waypoints. More detail: https://github.com/Expensify/App/issues/30290#issuecomment-1778957070 - onyxMethod: Onyx.METHOD.SET, + onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, value: { - ...optimisticTransaction, + ...updatedTransaction, pendingFields, isLoading: _.has(transactionChanges, 'waypoints'), errorFields: null, From e6557aec583bfe3654b9977ef92fd33073100d03 Mon Sep 17 00:00:00 2001 From: Pavlo Tsimura Date: Fri, 15 Dec 2023 18:45:03 +0100 Subject: [PATCH 2/2] Use TS-safe string coercing --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 29b32c35e6a4..24e795919649 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2123,7 +2123,7 @@ function getModifiedExpenseMessage(reportAction: OnyxEntry): strin const hasModifiedCreated = reportActionOriginalMessage && 'oldCreated' in reportActionOriginalMessage && 'created' in reportActionOriginalMessage; if (hasModifiedCreated) { // Take only the YYYY-MM-DD value as the original date includes timestamp - let formattedOldCreated: Date | string = new Date(reportActionOriginalMessage?.oldCreated ?? 0); + let formattedOldCreated: Date | string = new Date(reportActionOriginalMessage?.oldCreated ? reportActionOriginalMessage.oldCreated : 0); formattedOldCreated = format(formattedOldCreated, CONST.DATE.FNS_FORMAT_STRING); return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage?.created ?? '', formattedOldCreated?.toString?.(), Localize.translateLocal('common.date'), false);