Clean up cache and redux store after logout

Summary: There were redundant places we were cleaning up and logging out, now all syncronisation between the atom world and everything else is done via the atom subscription.

Reviewed By: aigoncharov

Differential Revision: D44463888

fbshipit-source-id: 9fc2af64b1e0667dd852096557107a48f2fa924c
This commit is contained in:
Luke De Feo
2023-03-30 10:05:59 -07:00
committed by Facebook GitHub Bot
parent 91c5a11e1b
commit 90069381e8

View File

@@ -50,7 +50,6 @@ import WelcomeScreen from './WelcomeScreen';
import {errorCounterAtom} from '../chrome/ConsoleLogs'; import {errorCounterAtom} from '../chrome/ConsoleLogs';
import {ToplevelProps} from './SandyApp'; import {ToplevelProps} from './SandyApp';
import {useValue} from 'flipper-plugin'; import {useValue} from 'flipper-plugin';
import {logout} from '../reducers/user';
import config from '../fb-stubs/config'; import config from '../fb-stubs/config';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import {showEmulatorLauncher} from './appinspect/LaunchEmulator'; import {showEmulatorLauncher} from './appinspect/LaunchEmulator';
@@ -79,7 +78,7 @@ import {css} from '@emotion/css';
import {getRenderHostInstance} from 'flipper-frontend-core'; import {getRenderHostInstance} from 'flipper-frontend-core';
import {StyleGuide} from './StyleGuide'; import {StyleGuide} from './StyleGuide';
import {useEffect} from 'react'; import {useEffect} from 'react';
import {isConnected, isLoggedIn} from '../fb-stubs/user'; import {isConnected, isLoggedIn, logoutUser} from '../fb-stubs/user';
const LeftRailButtonElem = styled(Button)<{kind?: 'small'}>(({kind}) => ({ const LeftRailButtonElem = styled(Button)<{kind?: 'small'}>(({kind}) => ({
width: kind === 'small' ? 32 : 36, width: kind === 'small' ? 32 : 36,
@@ -620,9 +619,9 @@ function LoginConnectivityButton() {
<Button <Button
block block
style={{backgroundColor: theme.backgroundDefault}} style={{backgroundColor: theme.backgroundDefault}}
onClick={() => { onClick={async () => {
onHandleVisibleChange(false); onHandleVisibleChange(false);
dispatch(logout()); await logoutUser();
}}> }}>
Log Out Log Out
</Button> </Button>