Skip to content

Commit

Permalink
correctly set onyx props when switching from OD
Browse files Browse the repository at this point in the history
  • Loading branch information
war-in committed Nov 4, 2024
1 parent f9b0e5a commit 377b686
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
}

Expand All @@ -509,7 +512,7 @@ function signInAfterTransitionFromOldDot(transitionURL: string) {
return new Promise<Route>((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
Expand Down

0 comments on commit 377b686

Please sign in to comment.