Skip to content

Commit

Permalink
Don't sign out until Onyx.clear() is finished
Browse files Browse the repository at this point in the history
  • Loading branch information
tgolen committed Jan 3, 2023
1 parent e58cad2 commit 6def1b3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
14 changes: 1 addition & 13 deletions src/libs/actions/Session/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,14 @@ Onyx.connect({
function signOut() {
Log.info('Flushing logs before signing out', true, {}, true);

const optimisticData = [
{
onyxMethod: CONST.ONYX.METHOD.SET,
key: ONYXKEYS.SESSION,
value: null,
},
{
onyxMethod: CONST.ONYX.METHOD.SET,
key: ONYXKEYS.CREDENTIALS,
value: {},
},
];
API.write('LogOut', {
// Send current authToken because we will immediately clear it once triggering this command
authToken: NetworkStore.getAuthToken(),
partnerUserID: lodashGet(credentials, 'autoGeneratedLogin', ''),
partnerName: CONFIG.EXPENSIFY.PARTNER_NAME,
partnerPassword: CONFIG.EXPENSIFY.PARTNER_PASSWORD,
shouldRetry: false,
}, {optimisticData});
});

Timing.clearData();
}
Expand Down
2 changes: 0 additions & 2 deletions src/libs/actions/SignInRedirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ function clearStorageAndRedirect(errorMessage) {
keysToPreserve.push(ONYXKEYS.NETWORK);
}

Timing.start('clear');
Onyx.clear(keysToPreserve)
.then(() => {
Timing.end('clear');
if (!errorMessage) {
return;
}
Expand Down

0 comments on commit 6def1b3

Please sign in to comment.