diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index b7fbe8bd2516..c18b3da3a173 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -363,6 +363,22 @@ function ReportScreen({route, navigation, isInSidePanel = false}: ReportScreenPr const {closeSidePanel} = useSidePanel(); + useEffect(() => { + if ( + !isFocused || + !reportIDFromRoute || + report?.reportID || + reportMetadata?.isLoadingInitialReportActions || + reportMetadata?.isOptimisticReport || + isLoadingApp || + userLeavingStatus + ) { + return; + } + + Navigation.goBack(); + }, [isFocused, reportIDFromRoute, report?.reportID, reportMetadata?.isLoadingInitialReportActions, reportMetadata?.isOptimisticReport, isLoadingApp, userLeavingStatus]); + useEffect(() => { if (!prevIsFocused || isFocused) { return;