From 2d012daf0c3ea49ac5d3dec6999d7b6ed23b6363 Mon Sep 17 00:00:00 2001 From: neil-marcellini Date: Tue, 16 Jul 2024 14:07:26 -0700 Subject: [PATCH 1/4] Avoid unnecessary expensive call to getTransactionDetails --- src/libs/ReportUtils.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 11350d724eb7..911e6bde68d4 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2958,16 +2958,17 @@ function getTransactionReportName(reportAction: OnyxEntry Date: Tue, 16 Jul 2024 14:52:46 -0700 Subject: [PATCH 2/4] Remove more inefficient calls to getTransactionDetails --- src/libs/ReportUtils.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 911e6bde68d4..f27e12829a59 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3014,9 +3014,9 @@ function getReportPreviewMessage( return Localize.translateLocal('iou.receiptMissingDetails'); } - const transactionDetails = getTransactionDetails(linkedTransaction); - const formattedAmount = CurrencyUtils.convertToDisplayString(transactionDetails?.amount ?? 0, transactionDetails?.currency); - return Localize.translateLocal('iou.didSplitAmount', {formattedAmount, comment: transactionDetails?.comment ?? ''}); + const amount = TransactionUtils.getAmount(linkedTransaction, !isEmptyObject(report) && isExpenseReport(report)) ?? 0; + const formattedAmount = CurrencyUtils.convertToDisplayString(amount, TransactionUtils.getCurrency(linkedTransaction)) ?? ''; + return Localize.translateLocal('iou.didSplitAmount', {formattedAmount, comment: TransactionUtils.getDescription(linkedTransaction) ?? ''}); } } @@ -3036,9 +3036,9 @@ function getReportPreviewMessage( return Localize.translateLocal('iou.receiptMissingDetails'); } - const transactionDetails = getTransactionDetails(linkedTransaction); - const formattedAmount = CurrencyUtils.convertToDisplayString(transactionDetails?.amount ?? 0, transactionDetails?.currency); - return Localize.translateLocal('iou.trackedAmount', {formattedAmount, comment: transactionDetails?.comment ?? ''}); + const amount = TransactionUtils.getAmount(linkedTransaction, !isEmptyObject(report) && isExpenseReport(report)) ?? 0; + const formattedAmount = CurrencyUtils.convertToDisplayString(amount, TransactionUtils.getCurrency(linkedTransaction)) ?? ''; + return Localize.translateLocal('iou.trackedAmount', {formattedAmount, comment: TransactionUtils.getDescription(linkedTransaction) ?? ''}); } } @@ -6404,8 +6404,8 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, return Localize.translateLocal(translationKey, {amount: formattedAmount, payer: ''}); } - const transactionDetails = getTransactionDetails(!isEmptyObject(transaction) ? transaction : undefined); - const formattedAmount = CurrencyUtils.convertToDisplayString(transactionDetails?.amount ?? 0, transactionDetails?.currency); + const amount = TransactionUtils.getAmount(transaction, !isEmptyObject(iouReport) && isExpenseReport(iouReport)) ?? 0; + const formattedAmount = CurrencyUtils.convertToDisplayString(amount, TransactionUtils.getCurrency(transaction)) ?? ''; const isRequestSettled = isSettled(originalMessage?.IOUReportID); const isApproved = isReportApproved(iouReport); if (isRequestSettled) { @@ -6427,7 +6427,7 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, } return Localize.translateLocal(translationKey, { formattedAmount, - comment: transactionDetails?.comment ?? '', + comment: TransactionUtils.getDescription(transaction) ?? '', }); } From e99e114f158092153d4d728f28a942438011aeed Mon Sep 17 00:00:00 2001 From: neil-marcellini Date: Tue, 16 Jul 2024 17:12:50 -0700 Subject: [PATCH 3/4] Fix ghToken arg name in prompt --- scripts/symbolicate-profile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index a100c05029dd..782671e07d31 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -53,7 +53,7 @@ if (argsMap.platform === undefined) { const githubToken = argsMap.ghToken ?? process.env.GITHUB_TOKEN; if (githubToken === undefined) { - Logger.error('No GitHub token provided. Either set a GITHUB_TOKEN environment variable or pass it using --gh-token'); + Logger.error('No GitHub token provided. Either set a GITHUB_TOKEN environment variable or pass it using --ghToken'); process.exit(1); } From 59c72216e82516fc5ec5942392f28dc79a4d384d Mon Sep 17 00:00:00 2001 From: neil-marcellini Date: Tue, 16 Jul 2024 17:14:36 -0700 Subject: [PATCH 4/4] Update other ghToken arg prompt --- scripts/symbolicate-profile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/symbolicate-profile.ts b/scripts/symbolicate-profile.ts index 782671e07d31..a58c2894edb6 100755 --- a/scripts/symbolicate-profile.ts +++ b/scripts/symbolicate-profile.ts @@ -32,7 +32,7 @@ if (Object.keys(argsMap).length === 0 || argsMap.help !== undefined) { Logger.log('Options:'); Logger.log(' --profile= The .cpuprofile file to symbolicate'); Logger.log(' --platform= The platform for which the source map was uploaded'); - Logger.log(' --gh-token Token to use for requests send to the GitHub API. By default tries to pick up from the environment variable GITHUB_TOKEN'); + Logger.log(' --ghToken Token to use for requests send to the GitHub API. By default tries to pick up from the environment variable GITHUB_TOKEN'); Logger.log(' --help Display this help message'); process.exit(0); }