From 9f19d0f1eba8f9a3b8c45ba9f8114204c1d1ee31 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Wed, 18 Oct 2023 23:56:21 -0400 Subject: [PATCH] Optimize shouldReportActionBeVisible --- src/libs/ReportActionsUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index db8ac3aadaa1..16260e0edea6 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -276,6 +276,9 @@ function isReportActionDeprecated(reportAction: OnyxEntry, key: st return false; } +const {POLICYCHANGELOG: policyChangelogTypes, ROOMCHANGELOG: roomChangeLogTypes, ...otherActionTypes} = CONST.REPORT.ACTIONS.TYPE; +const supportedActionTypes: ActionName[] = [...Object.values(otherActionTypes), ...Object.values(policyChangelogTypes), ...Object.values(roomChangeLogTypes)]; + /** * Checks if a reportAction is fit for display, meaning that it's not deprecated, is of a valid * and supported type, it's not deleted and also not closed. @@ -293,9 +296,6 @@ function shouldReportActionBeVisible(reportAction: OnyxEntry, key: return false; } - const {POLICYCHANGELOG: policyChangelogTypes, ROOMCHANGELOG: roomChangeLogTypes, ...otherActionTypes} = CONST.REPORT.ACTIONS.TYPE; - const supportedActionTypes: ActionName[] = [...Object.values(otherActionTypes), ...Object.values(policyChangelogTypes), ...Object.values(roomChangeLogTypes)]; - // Filter out any unsupported reportAction types if (!supportedActionTypes.includes(reportAction.actionName)) { return false;