From f454a83e91604b99f40b2dc850e72612dd0381af Mon Sep 17 00:00:00 2001 From: Dysto coder Date: Sat, 18 Oct 2025 17:45:25 +0300 Subject: [PATCH 1/2] open reports in search page only when a report is created from search page --- src/pages/NewReportWorkspaceSelectionPage.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/NewReportWorkspaceSelectionPage.tsx b/src/pages/NewReportWorkspaceSelectionPage.tsx index 48c6583af0cc4..fd3cc65850ac0 100644 --- a/src/pages/NewReportWorkspaceSelectionPage.tsx +++ b/src/pages/NewReportWorkspaceSelectionPage.tsx @@ -19,6 +19,7 @@ import useOnyx from '@hooks/useOnyx'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import {createNewReport} from '@libs/actions/Report'; +import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute'; import Navigation from '@libs/Navigation/Navigation'; import type {NewReportWorkspaceSelectionNavigatorParamList} from '@libs/Navigation/types'; import {getHeaderMessageForNonUserList} from '@libs/OptionsListUtils'; @@ -97,7 +98,10 @@ function NewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelectionPag } Navigation.setNavigationActionToMicrotaskQueue(() => { - Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID: optimisticReportID}), {forceReplace: isRHPOnReportInSearch || shouldUseNarrowLayout}); + Navigation.navigate( + isSearchTopmostFullScreenRoute() ? ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID: optimisticReportID}) : ROUTES.REPORT_WITH_ID.getRoute(optimisticReportID), + {forceReplace: isRHPOnReportInSearch || shouldUseNarrowLayout}, + ); }); }, [isRHPOnReportInSearch, shouldUseNarrowLayout], From 32b5e0892105e67b9fa871f4e31aea6e94388fce Mon Sep 17 00:00:00 2001 From: Dysto coder Date: Thu, 27 Nov 2025 00:23:03 +0300 Subject: [PATCH 2/2] fix crash issue on back navigation --- src/libs/Navigation/NavigationRoot.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index 5bd9d11485e8b..b8202e432b263 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -250,10 +250,7 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N const currentRoute = navigationRef.getCurrentRoute(); Firebase.log(`[NAVIGATION] screen: ${currentRoute?.name}, params: ${JSON.stringify(currentRoute?.params ?? {})}`); - // Performance optimization to avoid context consumers to delay first render - setTimeout(() => { - currentReportIDValue?.updateCurrentReportID(state); - }, 0); + currentReportIDValue?.updateCurrentReportID(state); parseAndLogRoute(state); // We want to clean saved scroll offsets for screens that aren't anymore in the state.