diff options
author | dan <dan.abramov@gmail.com> | 2023-11-23 00:30:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-23 00:30:49 +0000 |
commit | 4272d291a95620a4b22bfb395f53fad6414e4b71 (patch) | |
tree | 4b64c9ee31e7fcd7ab47762e74917ed2af1cf8c3 /src/state/session/index.tsx | |
parent | edf3114e476aef5da67ca76b4636ac3cfbcb26d8 (diff) | |
download | voidsky-4272d291a95620a4b22bfb395f53fad6414e4b71.tar.zst |
PWI: Profile (#1982)
* PWI: Profile * Show replies conditionally * Dismiss modals on auth action
Diffstat (limited to 'src/state/session/index.tsx')
-rw-r--r-- | src/state/session/index.tsx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/state/session/index.tsx b/src/state/session/index.tsx index d7541295b..1e7fa2297 100644 --- a/src/state/session/index.tsx +++ b/src/state/session/index.tsx @@ -9,6 +9,7 @@ import {PUBLIC_BSKY_AGENT} from '#/state/queries' import {IS_PROD} from '#/lib/constants' import {emitSessionLoaded, emitSessionDropped} from '../events' import {useLoggedOutViewControls} from '#/state/shell/logged-out' +import {useCloseAllActiveElements} from '#/state/util' let __globalAgent: BskyAgent = PUBLIC_BSKY_AGENT @@ -520,15 +521,17 @@ export function useSessionApi() { export function useRequireAuth() { const {hasSession} = useSession() const {setShowLoggedOut} = useLoggedOutViewControls() + const closeAll = useCloseAllActiveElements() return React.useCallback( (fn: () => void) => { if (hasSession) { fn() } else { + closeAll() setShowLoggedOut(true) } }, - [hasSession, setShowLoggedOut], + [hasSession, setShowLoggedOut, closeAll], ) } |