about summary refs log tree commit diff
path: root/src/screens
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-05-02 18:25:09 +0100
committerGitHub <noreply@github.com>2024-05-02 18:25:09 +0100
commit1a07e23192d06afd3879e89252f1bcfbb33df081 (patch)
treeb3d84d07475a4a97864387025144ea67d81dd5cb /src/screens
parent5ec945b7625a8daff3baaf76826c2f9e3c12e279 (diff)
downloadvoidsky-1a07e23192d06afd3879e89252f1bcfbb33df081.tar.zst
[Session] Extract selectAccount out (#3812)
Diffstat (limited to 'src/screens')
-rw-r--r--src/screens/Login/ChooseAccountForm.tsx5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/screens/Login/ChooseAccountForm.tsx b/src/screens/Login/ChooseAccountForm.tsx
index d36d10977..8a58ac03d 100644
--- a/src/screens/Login/ChooseAccountForm.tsx
+++ b/src/screens/Login/ChooseAccountForm.tsx
@@ -22,6 +22,7 @@ export const ChooseAccountForm = ({
   onSelectAccount: (account?: SessionAccount) => void
   onPressBack: () => void
 }) => {
+  const [isSwitchingAccounts, setIsSwitchingAccounts] = React.useState(false)
   const {track, screen} = useAnalytics()
   const {_} = useLingui()
   const {currentAccount} = useSession()
@@ -40,6 +41,7 @@ export const ChooseAccountForm = ({
           Toast.show(_(msg`Already signed in as @${account.handle}`))
         } else {
           try {
+            setIsSwitchingAccounts(true)
             await initSession(account)
             logEvent('account:loggedIn', {
               logContext: 'ChooseAccountForm',
@@ -54,6 +56,8 @@ export const ChooseAccountForm = ({
               message: e.message,
             })
             onSelectAccount(account)
+          } finally {
+            setIsSwitchingAccounts(false)
           }
         }
       } else {
@@ -74,6 +78,7 @@ export const ChooseAccountForm = ({
         <AccountList
           onSelectAccount={onSelect}
           onSelectOther={() => onSelectAccount()}
+          isSwitchingAccounts={isSwitchingAccounts}
         />
       </View>
       <View style={[a.flex_row]}>