From 377b6869707aa98b64b4e9617bb62e54fef273c7 Mon Sep 17 00:00:00 2001 From: war-in Date: Mon, 4 Nov 2024 11:56:47 +0100 Subject: [PATCH] correctly set onyx props when switching from OD --- src/libs/actions/Session/index.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts index 17f513dc34ce..4ca9a2ab2398 100644 --- a/src/libs/actions/Session/index.ts +++ b/src/libs/actions/Session/index.ts @@ -42,7 +42,7 @@ import {hideContextMenu} from '@pages/home/report/ContextMenu/ReportActionContex import * as App from '@userActions/App'; import {KEYS_TO_PRESERVE, openApp} from '@userActions/App'; import * as Device from '@userActions/Device'; -import {setReadyToShowAuthScreens} from '@userActions/HybridApp'; +import {setReadyToShowAuthScreens, setReadyToSwitchToClassicExperience} from '@userActions/HybridApp'; import * as PriorityMode from '@userActions/PriorityMode'; import redirectToSignIn from '@userActions/SignInRedirect'; import Timing from '@userActions/Timing'; @@ -482,16 +482,19 @@ function signUpUser() { function signInAfterTransitionFromOldDot(transitionURL: string) { const [route, queryParams] = transitionURL.split('?'); - const {useNewDotSignInPage, isSingleNewDotEntry} = Object.fromEntries( - queryParams.split('&').map((param) => { - const [key, value] = param.split('='); - return [key, value]; - }), - ); + const {useNewDotSignInPage, isSingleNewDotEntry} = queryParams + ? Object.fromEntries( + queryParams.split('&').map((param) => { + const [key, value] = param.split('='); + return [key, value]; + }), + ) + : {useNewDotSignInPage: undefined, isSingleNewDotEntry: undefined}; const clearOnyxBeforeSignIn = () => { if (useNewDotSignInPage !== 'true') { setReadyToShowAuthScreens(true); + setReadyToSwitchToClassicExperience(true); return Promise.resolve(); } @@ -509,7 +512,7 @@ function signInAfterTransitionFromOldDot(transitionURL: string) { return new Promise((resolve) => { clearOnyxBeforeSignIn() .then(() => { - const dismissed = useNewDotSignInPage === 'true' ? 'true' : 'false'; + const dismissed = useNewDotSignInPage === 'true' ? 'false' : 'false'; Onyx.multiSet({ [ONYXKEYS.HYBRID_APP]: {useNewDotSignInPage: useNewDotSignInPage === 'true'}, [ONYXKEYS.NVP_TRYNEWDOT]: {classicRedirect: {dismissed}}, // This data is mocked and should be returned by BeginSignUp/SignInUser API commands