From d5a8d967c1e233d10d1ef2c932d48697a877af14 Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Tue, 24 Sep 2024 09:58:27 +0200 Subject: [PATCH] Fix switching between home and workspace settings --- src/pages/home/sidebar/BottomTabAvatar.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pages/home/sidebar/BottomTabAvatar.tsx b/src/pages/home/sidebar/BottomTabAvatar.tsx index b9bf75f5ca0e..d72d236797b8 100644 --- a/src/pages/home/sidebar/BottomTabAvatar.tsx +++ b/src/pages/home/sidebar/BottomTabAvatar.tsx @@ -9,7 +9,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import interceptAnonymousUser from '@libs/interceptAnonymousUser'; import Navigation, {navigationRef} from '@libs/Navigation/Navigation'; -import type {AuthScreensParamList} from '@libs/Navigation/types'; +import type {WorkspaceSplitNavigatorParamList} from '@libs/Navigation/types'; import CONST from '@src/CONST'; import NAVIGATORS from '@src/NAVIGATORS'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -61,11 +61,10 @@ function BottomTabAvatar({isCreateMenuOpen = false, isSelected = false}: BottomT // If there is a workspace navigator route, then we should open the workspace initial screen as it should be "remembered". if (lastSettingsOrWorkspaceNavigatorRoute?.name === NAVIGATORS.WORKSPACE_SPLIT_NAVIGATOR) { - const params = lastSettingsOrWorkspaceNavigatorRoute.params as AuthScreensParamList[typeof NAVIGATORS.WORKSPACE_SPLIT_NAVIGATOR]; - + const params = lastSettingsOrWorkspaceNavigatorRoute.state?.routes.at(0)?.params as WorkspaceSplitNavigatorParamList[typeof SCREENS.WORKSPACE.INITIAL]; // Screens of this navigator should always have policyID - if ('params' in params && params.params?.policyID) { - Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(params.params.policyID)); + if (params.policyID) { + Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(params.policyID)); } return; }