diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 1898586217fd..68f030255822 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -278,6 +278,7 @@ function getOptionData({ hasParentAccess: undefined, isIOUReportOwner: null, isChatRoom: false, + isArchivedRoom: false, // eslint-disable-next-line @typescript-eslint/naming-convention private_isArchived: undefined, shouldShowSubscript: false, @@ -302,6 +303,8 @@ function getOptionData({ result.isTaskReport = ReportUtils.isTaskReport(report); result.isInvoiceReport = ReportUtils.isInvoiceReport(report); result.parentReportAction = parentReportAction; + const reportNameValuePairs = ReportUtils.getReportNameValuePairs(report?.reportID); + result.isArchivedRoom = ReportUtils.isArchivedRoom(report, reportNameValuePairs); // eslint-disable-next-line @typescript-eslint/naming-convention result.private_isArchived = report.private_isArchived; result.isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report); @@ -390,8 +393,8 @@ function getOptionData({ const isThreadMessage = ReportUtils.isThread(report) && lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT && lastAction?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; - const reportNameValuePairs = ReportUtils.getReportNameValuePairs(report?.reportID); - if ((result.isChatRoom || result.isPolicyExpenseChat || result.isThread || result.isTaskReport || isThreadMessage) && !ReportUtils.isArchivedRoom(report, reportNameValuePairs)) { + + if ((result.isChatRoom || result.isPolicyExpenseChat || result.isThread || result.isTaskReport || isThreadMessage) && !result.isArchivedRoom) { const lastActionName = lastAction?.actionName ?? report.lastActionType; if (ReportActionsUtils.isRenamedAction(lastAction)) {