Skip to content

Commit

Permalink
Merge pull request #32691 from Expensify/jasper-fixCreatingFreeWorksp…
Browse files Browse the repository at this point in the history
…aceFromOldDot

Fix creating free workspaces from OldDot
  • Loading branch information
marcochavezf authored Dec 7, 2023
2 parents e413f74 + 96b7ca6 commit ae85769
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -2002,6 +2002,14 @@ function openReportFromDeepLink(url, isAuthenticated) {
Session.signOutAndRedirectToSignIn();
return;
}

// We don't want to navigate to the exitTo route when creating a new workspace from a deep link,
// because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate,
// which is already called when AuthScreens mounts.
if (new URL(url).searchParams.get('exitTo') === ROUTES.WORKSPACE_NEW) {
return;
}

Navigation.navigate(route, CONST.NAVIGATION.ACTION_TYPE.PUSH);
});
});
Expand Down
6 changes: 5 additions & 1 deletion src/pages/LogOutPreviousUserPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as SessionUtils from '@libs/SessionUtils';
import Navigation from '@navigation/Navigation';
import * as Session from '@userActions/Session';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';

const propTypes = {
/** The details about the account that the user is signing in with */
Expand Down Expand Up @@ -54,7 +55,10 @@ function LogOutPreviousUserPage(props) {
}

const exitTo = lodashGet(props, 'route.params.exitTo', '');
if (exitTo && !props.account.isLoading && !isLoggingInAsNewUser) {
// We don't want to navigate to the exitTo route when creating a new workspace from a deep link,
// because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate,
// which is already called when AuthScreens mounts.
if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) {
Navigation.isNavigationReady().then(() => {
Navigation.navigate(exitTo);
});
Expand Down

0 comments on commit ae85769

Please sign in to comment.