Skip to content

Commit f99dbdc

Browse files
authored
Merge pull request Expensify#63650 from callstack-internal/use-staging-server-persistence
fix: Persist troubleshooting flags across login sessions
2 parents cc57e93 + 83a9a32 commit f99dbdc

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/libs/actions/SignInRedirect.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,17 @@ function clearStorageAndRedirect(errorMessage?: string): Promise<void> {
3232
keysToPreserve.push(ONYXKEYS.NETWORK);
3333
}
3434

35+
// Preserve troubleshooting flags
36+
keysToPreserve.push(ONYXKEYS.APP_PROFILING_IN_PROGRESS);
37+
keysToPreserve.push(ONYXKEYS.SHOULD_STORE_LOGS);
38+
keysToPreserve.push(ONYXKEYS.SHOULD_MASK_ONYX_STATE);
39+
40+
// Preserve account settings (staging server, debug mode, etc.) across logout
41+
keysToPreserve.push(ONYXKEYS.ACCOUNT);
42+
3543
return Onyx.clear(keysToPreserve).then(() => {
3644
clearAllPolicies();
45+
3746
if (!errorMessage) {
3847
return;
3948
}

src/pages/signin/SignInPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ function getRenderOptions({
106106
// SAML required users may reload the login page after having already entered their login details, in which
107107
// case we want to clear their sign in data so they don't end up in an infinite loop redirecting back to their
108108
// SSO provider's login page
109-
if (hasLogin && isSAMLRequired && !shouldInitiateSAMLLogin && !hasInitiatedSAMLLogin && !account.isLoading) {
109+
// Don't clear if we don't have account data - this prevents clearing during app resets when state is inconsistent
110+
if (hasAccount && hasLogin && isSAMLRequired && !shouldInitiateSAMLLogin && !hasInitiatedSAMLLogin && !account.isLoading) {
110111
clearSignInData();
111112
}
112113

0 commit comments

Comments
 (0)