From e624685dec7595520b44e4bb01bdd74bcaa4a19d Mon Sep 17 00:00:00 2001 From: Wildan Muhlis Date: Wed, 11 Sep 2024 10:59:04 +0700 Subject: [PATCH 1/2] Add condition to show last reportAction in skeleton --- src/pages/home/ReportScreen.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 4491a12e6bbd8..6c41a03a3ea3e 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -720,6 +720,12 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro Report.readNewestAction(report.reportID); }, [report]); const firstReportAction = reportActions[0]; + const shouldRenderFirstReportAction = !!firstReportAction && + !ReportActionsUtils.isActionOfType(firstReportAction, CONST.REPORT.ACTIONS.TYPE.CREATED) && + !ReportActionsUtils.isDeletedAction(firstReportAction); + + + console.log('[wildebug] firstReportAction', firstReportAction) const lastRoute = usePrevious(route); const lastReportActionIDFromRoute = usePrevious(reportActionIDFromRoute); @@ -801,7 +807,7 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro {shouldShowSkeleton && ( <> - {!!firstReportAction && ( + {shouldRenderFirstReportAction && ( Date: Thu, 12 Sep 2024 07:23:16 +0700 Subject: [PATCH 2/2] change firstReportAction to shouldShowMostRecentReportAction for more accurate description --- src/pages/home/ReportScreen.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 6c41a03a3ea3e..fd0e22fd6b447 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -719,13 +719,11 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro // After creating the task report then navigating to task detail we don't have any report actions and the last read time is empty so We need to update the initial last read time when opening the task report detail. Report.readNewestAction(report.reportID); }, [report]); - const firstReportAction = reportActions[0]; - const shouldRenderFirstReportAction = !!firstReportAction && - !ReportActionsUtils.isActionOfType(firstReportAction, CONST.REPORT.ACTIONS.TYPE.CREATED) && - !ReportActionsUtils.isDeletedAction(firstReportAction); - - - console.log('[wildebug] firstReportAction', firstReportAction) + const mostRecentReportAction = reportActions[0]; + const shouldShowMostRecentReportAction = + !!mostRecentReportAction && + !ReportActionsUtils.isActionOfType(mostRecentReportAction, CONST.REPORT.ACTIONS.TYPE.CREATED) && + !ReportActionsUtils.isDeletedAction(mostRecentReportAction); const lastRoute = usePrevious(route); const lastReportActionIDFromRoute = usePrevious(reportActionIDFromRoute); @@ -807,9 +805,9 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro {shouldShowSkeleton && ( <> - {shouldRenderFirstReportAction && ( + {shouldShowMostRecentReportAction && (