diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 9c4d21b40ded..916a499fe2ed 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -399,6 +399,12 @@ function ReportScreen({ return false; } + // If we just finished loading the app, we still need to try fetching the report. Wait until that's done before + // showing the Not Found page + if (finishedLoadingApp) { + return false; + } + if (!wasReportAccessibleRef.current && !firstRenderRef.current && !report.reportID && !isOptimisticDelete && !reportMetadata?.isLoadingInitialReportActions && !userLeavingStatus) { return true; } @@ -408,7 +414,7 @@ function ReportScreen({ } return !!currentReportIDFormRoute && !ReportUtils.isValidReportIDFromPath(currentReportIDFormRoute); - }, [isLoadingApp, report.reportID, isOptimisticDelete, reportMetadata?.isLoadingInitialReportActions, userLeavingStatus, shouldHideReport, currentReportIDFormRoute]); + }, [isLoadingApp, finishedLoadingApp, report.reportID, isOptimisticDelete, reportMetadata?.isLoadingInitialReportActions, userLeavingStatus, shouldHideReport, currentReportIDFormRoute]); const fetchReport = useCallback(() => { Report.openReport(reportIDFromRoute, reportActionIDFromRoute);