From 2e6fb67b1f978ae443f062fb8b11a2671dc44277 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Thu, 7 Dec 2023 09:53:16 -0800 Subject: [PATCH 1/9] fix navigating to draft workspaces from OldDot --- src/libs/actions/Report.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index e5bac3182b0d..b40c92a33aed 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -2002,6 +2002,11 @@ function openReportFromDeepLink(url, isAuthenticated) { Session.signOutAndRedirectToSignIn(); return; } + + if (!reportID) { + return; + } + Navigation.navigate(route, CONST.NAVIGATION.ACTION_TYPE.PUSH); }); }); From 48ce451fe6121a4686b5eebbcc5e0114e166b6df Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Thu, 7 Dec 2023 10:11:23 -0800 Subject: [PATCH 2/9] update condition to be safer --- src/libs/actions/Report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index b40c92a33aed..a1d1ba48721b 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -2003,7 +2003,7 @@ function openReportFromDeepLink(url, isAuthenticated) { return; } - if (!reportID) { + if (new URL(url).searchParams.get('exitTo') === ROUTES.WORKSPACE_NEW) { return; } From a264dcc899b7534527944071601df93309b61213 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Thu, 7 Dec 2023 10:15:53 -0800 Subject: [PATCH 3/9] update condition --- src/pages/LogOutPreviousUserPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index df38c28e561a..7cfe86767d76 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -54,7 +54,7 @@ function LogOutPreviousUserPage(props) { } const exitTo = lodashGet(props, 'route.params.exitTo', ''); - if (exitTo && !props.account.isLoading && !isLoggingInAsNewUser) { + if (exitTo && !props.account.isLoading && !isLoggingInAsNewUser && exitTo !== ROUTES.WORKSPACE_NEW) { Navigation.isNavigationReady().then(() => { Navigation.navigate(exitTo); }); From 0fcca8364a7b5030d9b301b225238b641357d2c5 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Thu, 7 Dec 2023 10:18:13 -0800 Subject: [PATCH 4/9] fix condition order --- src/pages/LogOutPreviousUserPage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 7cfe86767d76..cfc1061a59af 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -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 */ @@ -54,7 +55,7 @@ function LogOutPreviousUserPage(props) { } const exitTo = lodashGet(props, 'route.params.exitTo', ''); - if (exitTo && !props.account.isLoading && !isLoggingInAsNewUser && exitTo !== ROUTES.WORKSPACE_NEW) { + if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { Navigation.navigate(exitTo); }); From 5c4e29a01dabb9f00368b666781d4b7ecf302843 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Thu, 7 Dec 2023 10:30:47 -0800 Subject: [PATCH 5/9] add comment --- src/pages/LogOutPreviousUserPage.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index cfc1061a59af..e6051f2ca101 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -55,6 +55,8 @@ function LogOutPreviousUserPage(props) { } const exitTo = lodashGet(props, 'route.params.exitTo', ''); + // 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 setUpPoliciesAndNavigate. if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { Navigation.navigate(exitTo); From 60cb6c998b4cb81f45a369c105917aface4bb2ae Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Thu, 7 Dec 2023 10:31:30 -0800 Subject: [PATCH 6/9] update comment --- src/pages/LogOutPreviousUserPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index e6051f2ca101..abd331ba0aac 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -56,7 +56,7 @@ function LogOutPreviousUserPage(props) { const exitTo = lodashGet(props, 'route.params.exitTo', ''); // 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 setUpPoliciesAndNavigate. + // because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate. if (exitTo && exitTo !== ROUTES.WORKSPACE_NEW && !props.account.isLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { Navigation.navigate(exitTo); From a85cc03a65cb64efec44653d9d3c7e6e1af16b1a Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Thu, 7 Dec 2023 10:36:06 -0800 Subject: [PATCH 7/9] add comment --- src/libs/actions/Report.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index a1d1ba48721b..5a1582fc40a5 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -2003,6 +2003,8 @@ function openReportFromDeepLink(url, isAuthenticated) { 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. if (new URL(url).searchParams.get('exitTo') === ROUTES.WORKSPACE_NEW) { return; } From d9146ee3ba410bc1c583782a66be0d2d35b1fee5 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Thu, 7 Dec 2023 10:37:26 -0800 Subject: [PATCH 8/9] update comments --- src/libs/actions/Report.js | 3 ++- src/pages/LogOutPreviousUserPage.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 5a1582fc40a5..ec34cfca0b62 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -2004,7 +2004,8 @@ function openReportFromDeepLink(url, isAuthenticated) { } // 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. + // 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; } diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index abd331ba0aac..65c358fabf55 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -57,6 +57,7 @@ function LogOutPreviousUserPage(props) { const exitTo = lodashGet(props, 'route.params.exitTo', ''); // 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); From 96b7ca6f1204cea2b869a25be714bcecc98b3978 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Thu, 7 Dec 2023 10:37:40 -0800 Subject: [PATCH 9/9] update comments --- src/pages/LogOutPreviousUserPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/LogOutPreviousUserPage.js b/src/pages/LogOutPreviousUserPage.js index 65c358fabf55..9609f3f9bd56 100644 --- a/src/pages/LogOutPreviousUserPage.js +++ b/src/pages/LogOutPreviousUserPage.js @@ -56,7 +56,7 @@ function LogOutPreviousUserPage(props) { const exitTo = lodashGet(props, 'route.params.exitTo', ''); // 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. + // 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(() => {