From 379e64103d89b062d865b51bacca2db028eaf568 Mon Sep 17 00:00:00 2001 From: "David E. Gelhar" Date: Tue, 27 Feb 2024 07:39:08 -0500 Subject: [PATCH 1/2] allow navigating back from SAML signin --- src/libs/Navigation/NavigationRoot.tsx | 7 ++++++- src/pages/signin/SAMLSignInPage/index.tsx | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index 20c426a74c71..6694b950fb2b 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -45,7 +45,7 @@ function parseAndLogRoute(state: NavigationState) { const focusedRoute = findFocusedRoute(state); - if (focusedRoute?.name !== SCREENS.NOT_FOUND) { + if (focusedRoute?.name !== SCREENS.NOT_FOUND && focusedRoute?.name !== SCREENS.SAML_SIGN_IN) { updateLastVisitedPath(currentPath); } @@ -70,6 +70,8 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N const initialState = useMemo( () => { + Log.info('Navigating lastVisitedPath', false, { lastVisitedPath: lastVisitedPath}); + if (!lastVisitedPath) { return undefined; } @@ -82,6 +84,9 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N } const {adaptedState} = getAdaptedStateFromPath(lastVisitedPath, linkingConfig.config); + + Log.info('Navigating initialState', false, {initialState: initialState, lastVisitedPath: lastVisitedPath}); + return adaptedState; }, // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/src/pages/signin/SAMLSignInPage/index.tsx b/src/pages/signin/SAMLSignInPage/index.tsx index 701c2917bea6..1ff9d02672be 100644 --- a/src/pages/signin/SAMLSignInPage/index.tsx +++ b/src/pages/signin/SAMLSignInPage/index.tsx @@ -7,7 +7,7 @@ import type {SAMLSignInPageOnyxProps, SAMLSignInPageProps} from './types'; function SAMLSignInPage({credentials}: SAMLSignInPageProps) { useEffect(() => { - window.open(`${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials?.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`, '_self'); + window.location.replace(`${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials?.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`); }, [credentials?.login]); return ; From 4eca3a13ce408181c0fba2fe0fbe6f0d18732301 Mon Sep 17 00:00:00 2001 From: "David E. Gelhar" Date: Tue, 27 Feb 2024 08:10:26 -0500 Subject: [PATCH 2/2] remove debug logging --- src/libs/Navigation/NavigationRoot.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index 6694b950fb2b..2ca4c5178a5e 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -70,8 +70,6 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N const initialState = useMemo( () => { - Log.info('Navigating lastVisitedPath', false, { lastVisitedPath: lastVisitedPath}); - if (!lastVisitedPath) { return undefined; } @@ -84,9 +82,6 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N } const {adaptedState} = getAdaptedStateFromPath(lastVisitedPath, linkingConfig.config); - - Log.info('Navigating initialState', false, {initialState: initialState, lastVisitedPath: lastVisitedPath}); - return adaptedState; }, // eslint-disable-next-line react-hooks/exhaustive-deps