about summary refs log tree commit diff
path: root/src/view/com/modals/SwitchAccount.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-12-08 14:01:20 -0800
committerPaul Frazee <pfrazee@gmail.com>2023-12-08 14:01:20 -0800
commit565979e71f99064506af933493a118a2e22a044a (patch)
tree6193be73348fc6fb8248879efceab97e30ff353b /src/view/com/modals/SwitchAccount.tsx
parent282879b6452b0f575369d30139d15b234f7a3f28 (diff)
parent7b686b5592a8cd01278c5c30e115385ffd676248 (diff)
downloadvoidsky-565979e71f99064506af933493a118a2e22a044a.tar.zst
Merge branch 'main' of github.com:bluesky-social/social-app into main
Diffstat (limited to 'src/view/com/modals/SwitchAccount.tsx')
-rw-r--r--src/view/com/modals/SwitchAccount.tsx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/view/com/modals/SwitchAccount.tsx b/src/view/com/modals/SwitchAccount.tsx
index 38e1ce1e0..37691e717 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,14 @@ 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()
+    // needs to be in timeout or the modal re-opens
+    setTimeout(() => logout(), 0)
+  }, [track, logout, closeAllActiveElements])
 
   const contents = (
     <View style={[pal.view, styles.linkCard]}>