diff options
author | Eric Bailey <git@esb.lol> | 2023-11-08 12:34:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-08 10:34:10 -0800 |
commit | f18b15241ab708f8c25a11937a875e361e9f1221 (patch) | |
tree | 07829ce8617cb858b4519d6f16c89c7e43f84d9c /src/lib/hooks/useAccountSwitcher.ts | |
parent | 5eadadffbf5475b233da7b1463e2345ff3e3cfce (diff) | |
download | voidsky-f18b15241ab708f8c25a11937a875e361e9f1221.tar.zst |
Add modal state provider, replace usage except methods (#1833)
* Add modal state provider, replace usage except methods * Replace easy spots * Fix sticky spots * Replace final usages * Memorize context objects * Add more warnings
Diffstat (limited to 'src/lib/hooks/useAccountSwitcher.ts')
-rw-r--r-- | src/lib/hooks/useAccountSwitcher.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/hooks/useAccountSwitcher.ts b/src/lib/hooks/useAccountSwitcher.ts index 1ddb181a8..b165fddb5 100644 --- a/src/lib/hooks/useAccountSwitcher.ts +++ b/src/lib/hooks/useAccountSwitcher.ts @@ -7,6 +7,7 @@ import {AccountData} from 'state/models/session' import {reset as resetNavigation} from '../../Navigation' import * as Toast from 'view/com/util/Toast' import {useSetDrawerOpen} from '#/state/shell/drawer-open' +import {useModalControls} from '#/state/modals' export function useAccountSwitcher(): [ boolean, @@ -16,6 +17,7 @@ export function useAccountSwitcher(): [ const {track} = useAnalytics() const store = useStores() const setDrawerOpen = useSetDrawerOpen() + const {closeModal} = useModalControls() const [isSwitching, setIsSwitching] = useState(false) const navigation = useNavigation<NavigationProp>() @@ -25,6 +27,7 @@ export function useAccountSwitcher(): [ setIsSwitching(true) const success = await store.session.resumeSession(acct) setDrawerOpen(false) + closeModal() store.shell.closeAllActiveElements() if (success) { resetNavigation() @@ -36,7 +39,7 @@ export function useAccountSwitcher(): [ store.session.clear() } }, - [track, setIsSwitching, navigation, store, setDrawerOpen], + [track, setIsSwitching, navigation, store, setDrawerOpen, closeModal], ) return [isSwitching, setIsSwitching, onPressSwitchAccount] |