From 9713a82e99060e9b4ce4e46d631415794211ebd7 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Fri, 8 Dec 2023 12:25:20 -0600 Subject: [PATCH] Close account switcher before logging out --- src/view/com/modals/SwitchAccount.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/view/com/modals/SwitchAccount.tsx b/src/view/com/modals/SwitchAccount.tsx index 38e1ce1e0f..43bdce8af9 100644 --- a/src/view/com/modals/SwitchAccount.tsx +++ b/src/view/com/modals/SwitchAccount.tsx @@ -20,6 +20,7 @@ import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useSession, useSessionApi, SessionAccount} from '#/state/session' import {useProfileQuery} from '#/state/queries/profile' +import {useCloseAllActiveElements} from '#/state/util' export const snapPoints = ['40%', '90%'] @@ -32,11 +33,15 @@ function SwitchAccountCard({account}: {account: SessionAccount}) { const {data: profile} = useProfileQuery({did: account.did}) const isCurrentAccount = account.did === currentAccount?.did const {onPressSwitchAccount} = useAccountSwitcher() + const closeAllActiveElements = useCloseAllActiveElements() const onPressSignout = React.useCallback(() => { track('Settings:SignOutButtonClicked') - logout() - }, [track, logout]) + closeAllActiveElements() + setTimeout(() => { + logout() + }, 0) + }, [track, logout, closeAllActiveElements]) const contents = (