From 4a2d4253e54f1bf3a375c6c6ffdbd5a9b6bcc24a Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 3 May 2024 17:57:09 +0100 Subject: [Session] Align state and global agent switchpoints (#3845) * Adopt synced accounts unconditionally * Remove try/catch around resuming session * Move to login form on resume failure * Restructure code flow for easier reading --------- Co-authored-by: Eric Bailey --- src/lib/hooks/useAccountSwitcher.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/lib/hooks/useAccountSwitcher.ts') diff --git a/src/lib/hooks/useAccountSwitcher.ts b/src/lib/hooks/useAccountSwitcher.ts index 558fcf74b..ad529f912 100644 --- a/src/lib/hooks/useAccountSwitcher.ts +++ b/src/lib/hooks/useAccountSwitcher.ts @@ -15,7 +15,7 @@ export function useAccountSwitcher() { const [pendingDid, setPendingDid] = useState(null) const {_} = useLingui() const {track} = useAnalytics() - const {initSession, clearCurrentAccount} = useSessionApi() + const {initSession} = useSessionApi() const {requestSwitchToAccount} = useLoggedOutViewControls() const onPressSwitchAccount = useCallback( @@ -53,19 +53,11 @@ export function useAccountSwitcher() { logger.error(`switch account: selectAccount failed`, { message: e.message, }) - clearCurrentAccount() // back user out to login } finally { setPendingDid(null) } }, - [ - _, - track, - clearCurrentAccount, - initSession, - requestSwitchToAccount, - pendingDid, - ], + [_, track, initSession, requestSwitchToAccount, pendingDid], ) return {onPressSwitchAccount, pendingDid} -- cgit 1.4.1