From e6e88bea82cf066ccc86e12ebe1c8de47fc529fd Mon Sep 17 00:00:00 2001 From: Aldo Canepa Date: Thu, 14 Oct 2021 19:46:49 -0700 Subject: [PATCH 1/2] Just load policy list when url not available --- src/libs/Navigation/AppNavigator/AuthScreens.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index 10f22a0ca3cd..49455ee31eef 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -170,10 +170,14 @@ class AuthScreens extends React.Component { // Load policies, maybe creating a new policy first. Linking.getInitialURL() .then((url) => { - const path = new URL(url).pathname; - const exitTo = new URLSearchParams(url).get('exitTo'); - const shouldCreateFreePolicy = Str.startsWith(path, Str.normalizeUrl(ROUTES.LOGIN_WITH_SHORT_LIVED_TOKEN)) && exitTo === ROUTES.WORKSPACE_NEW; - getPolicyList(shouldCreateFreePolicy); + if (url) { + const path = new URL(url).pathname; + const exitTo = new URLSearchParams(url).get('exitTo'); + const shouldCreateFreePolicy = Str.startsWith(path, Str.normalizeUrl(ROUTES.LOGIN_WITH_SHORT_LIVED_TOKEN)) && exitTo === ROUTES.WORKSPACE_NEW; + getPolicyList(shouldCreateFreePolicy); + } else { + getPolicyList(false); + } }); // Refresh the personal details, timezone and betas every 30 minutes From 6086b07608ca32a5fe13675d514aa9c36f0fbc95 Mon Sep 17 00:00:00 2001 From: Aldo Canepa Date: Thu, 14 Oct 2021 19:55:45 -0700 Subject: [PATCH 2/2] Add comment --- src/libs/Navigation/AppNavigator/AuthScreens.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js index 49455ee31eef..809d6d1bffb8 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.js +++ b/src/libs/Navigation/AppNavigator/AuthScreens.js @@ -170,6 +170,7 @@ class AuthScreens extends React.Component { // Load policies, maybe creating a new policy first. Linking.getInitialURL() .then((url) => { + // url is null on mobile unless the app was opened via a deeplink if (url) { const path = new URL(url).pathname; const exitTo = new URLSearchParams(url).get('exitTo');