diff --git a/src/libs/Navigation/linkTo/index.ts b/src/libs/Navigation/linkTo/index.ts index 90e52d02163c..3c4608d6b5de 100644 --- a/src/libs/Navigation/linkTo/index.ts +++ b/src/libs/Navigation/linkTo/index.ts @@ -72,17 +72,21 @@ export default function linkTo(navigation: NavigationContainerRef | undefined, (value) => value === undefined), - omitBy(actionParams?.params as Record | undefined, (value) => value === undefined), + omitBy(targetParams as Record | undefined, (value) => value === undefined), ); // If this action is navigating to the report screen and the top most navigator is different from the one we want to navigate - PUSH the new screen to the top of the stack by default @@ -110,8 +114,8 @@ export default function linkTo(navigation: NavigationContainerRef).policyIDs = policyID; + if (targetName === SCREENS.SEARCH.CENTRAL_PANE && targetParams && policyID) { + (targetParams as Record).policyIDs = policyID; } // If the type is UP, we deeplinked into one of the RHP flows and we want to replace the current screen with the previous one in the flow diff --git a/src/libs/NavigationUtils.ts b/src/libs/NavigationUtils.ts index f0442e4995d2..4fdc03c3d334 100644 --- a/src/libs/NavigationUtils.ts +++ b/src/libs/NavigationUtils.ts @@ -1,7 +1,7 @@ import SCREENS from '@src/SCREENS'; import type {CentralPaneName} from './Navigation/types'; -const CENTRAL_PANE_SCREEN_NAMES = [ +const CENTRAL_PANE_SCREEN_NAMES = new Set([ SCREENS.SETTINGS.WORKSPACES, SCREENS.SETTINGS.PREFERENCES.ROOT, SCREENS.SETTINGS.SECURITY, @@ -13,14 +13,14 @@ const CENTRAL_PANE_SCREEN_NAMES = [ SCREENS.SETTINGS.SUBSCRIPTION.ROOT, SCREENS.SEARCH.CENTRAL_PANE, SCREENS.REPORT, -]; +]); function isCentralPaneName(screen: string | undefined): screen is CentralPaneName { if (!screen) { return false; } - return CENTRAL_PANE_SCREEN_NAMES.includes(screen as CentralPaneName); + return CENTRAL_PANE_SCREEN_NAMES.has(screen as CentralPaneName); } export default isCentralPaneName;