Skip to content

Commit

Permalink
Merge pull request Expensify#36498 from software-mansion-labs/fix/cre…
Browse files Browse the repository at this point in the history
…ate-workspace-from-old-dot

Prevent calling `Welcome.show()` on the workspace settings screen
  • Loading branch information
stitesExpensify authored Feb 19, 2024
2 parents 021c1fd + b1f989f commit 2701e05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ function BottomTabBar({isLoadingApp = false}: PurposeForUsingExpensifyModalProps
const navigationState = navigation.getState();
const routes = navigationState.routes;
const currentRoute = routes[navigationState.index];

if (currentRoute && currentRoute.name !== NAVIGATORS.BOTTOM_TAB_NAVIGATOR && currentRoute.name !== NAVIGATORS.CENTRAL_PANE_NAVIGATOR) {
const bottomTabRoute = getTopmostBottomTabRoute(navigationState);
if (
// When we are redirected to the Settings tab from the OldDot, we don't want to call the Welcome.show() method.
// To prevent this, the value of the bottomTabRoute?.name is checked here
bottomTabRoute?.name === SCREENS.WORKSPACE.INITIAL ||
(currentRoute && currentRoute.name !== NAVIGATORS.BOTTOM_TAB_NAVIGATOR && currentRoute.name !== NAVIGATORS.CENTRAL_PANE_NAVIGATOR)
) {
return;
}

Expand Down
4 changes: 1 addition & 3 deletions src/libs/actions/Welcome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,11 @@ function show(routes: NavigationState<RootStackParamList>['routes'], showEngagem
const transitionRoute = routes.find(
(route): route is NavigationState<Pick<RootStackParamList, typeof SCREENS.TRANSITION_BETWEEN_APPS>>['routes'][number] => route.name === SCREENS.TRANSITION_BETWEEN_APPS,
);
const activeRoute = Navigation.getActiveRouteWithoutParams();
const isOnWorkspaceOverviewPage = activeRoute?.startsWith('/workspace') && activeRoute?.endsWith('/overview');
const isExitingToWorkspaceRoute = transitionRoute?.params?.exitTo === 'workspace/new';

// If we already opened the workspace settings or want the admin room to stay open, do not
// navigate away to the workspace chat report
const shouldNavigateToWorkspaceChat = !isExitingToWorkspaceRoute && !isOnWorkspaceOverviewPage;
const shouldNavigateToWorkspaceChat = !isExitingToWorkspaceRoute;

const workspaceChatReport = Object.values(allReports ?? {}).find((report) => {
if (report) {
Expand Down

0 comments on commit 2701e05

Please sign in to comment.