diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index ca337a8e4546..3791cd5bdd5a 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -85,6 +85,7 @@ function ReportActionsView({ const prevTransactionThreadReport = usePrevious(transactionThreadReport); const reportActionID = route?.params?.reportActionID; const prevReportActionID = usePrevious(reportActionID); + const reportPreviewAction = useMemo(() => getReportPreviewAction(report.chatReportID, report.reportID), [report.chatReportID, report.reportID]); const didLayout = useRef(false); const {isOffline} = useNetwork(); @@ -136,7 +137,6 @@ function ReportActionsView({ actions.push(optimisticCreatedAction); } - const reportPreviewAction = getReportPreviewAction(report.chatReportID, report.reportID); const moneyRequestActions = allReportActions.filter((action) => { const originalMessage = isMoneyRequestAction(action) ? getOriginalMessage(action) : undefined; return ( @@ -171,7 +171,7 @@ function ReportActionsView({ } return [...actions, createdAction]; - }, [allReportActions, report, transactionThreadReport]); + }, [allReportActions, report, transactionThreadReport, reportPreviewAction]); // Get a sorted array of reportActions for both the current report and the transaction thread report associated with this report (if there is one) // so that we display transaction-level and report-level report actions in order in the one-transaction view @@ -206,6 +206,10 @@ function ReportActionsView({ actionCreated && lastVisibleActionCreated ? actionCreated >= lastVisibleActionCreated : actionCreated === lastVisibleActionCreated; const hasNewestReportAction = isNewestAction(lastActionCreated, report.lastVisibleActionCreated) || isNewestAction(lastActionCreated, transactionThreadReport?.lastVisibleActionCreated); + const isSingleExpenseReport = reportPreviewAction?.childMoneyRequestCount === 1; + const isReportDataIncomplete = isSingleExpenseReport; + const isMissingReportActions = visibleReportActions.length === 0; + useEffect(() => { // update ref with current state prevShouldUseNarrowLayoutRef.current = shouldUseNarrowLayout; @@ -271,11 +275,11 @@ function ReportActionsView({ }; }, [isTheFirstReportActionIsLinked]); - if ((isLoadingInitialReportActions && !isOffline) ?? isLoadingApp) { + if ((isLoadingInitialReportActions && (isReportDataIncomplete || isMissingReportActions) && !isOffline) ?? isLoadingApp) { return ; } - if (visibleReportActions.length === 0) { + if (isMissingReportActions) { return ; }