diff options
author | Eric Bailey <git@esb.lol> | 2023-11-13 10:20:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 08:20:38 -0800 |
commit | 37a2204483c019f8b85dafb7bafa3e6a5caec1a8 (patch) | |
tree | 2124b1fab07bb3d0d61bb6d678ef3a0933293f57 /src/state/session/index.tsx | |
parent | b445c15cc99a56c2baf727d05cf53b44aef4542b (diff) | |
download | voidsky-37a2204483c019f8b85dafb7bafa3e6a5caec1a8.tar.zst |
Update clear account behavior, ensure agent is set (#1881)
Diffstat (limited to 'src/state/session/index.tsx')
-rw-r--r-- | src/state/session/index.tsx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/state/session/index.tsx b/src/state/session/index.tsx index d0ca10137..e01e841f6 100644 --- a/src/state/session/index.tsx +++ b/src/state/session/index.tsx @@ -178,6 +178,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { }), ) + setState(s => ({...s, agent})) upsertAccount(account) logger.debug( @@ -373,9 +374,14 @@ export function Provider({children}: React.PropsWithChildren<{}>) { [setState, initSession], ) + /** + * Clears the `currentAccount` from session. Typically used to drop the user + * back to the sign-in page. + */ const clearCurrentAccount = React.useCallback(() => { setStateAndPersist(s => ({ ...s, + agent: PUBLIC_BSKY_AGENT, currentAccount: undefined, })) }, [setStateAndPersist]) @@ -425,10 +431,10 @@ export function Provider({children}: React.PropsWithChildren<{}>) { logger.DebugContext.session, ) - logout() + clearCurrentAccount() } }) - }, [state, logout, initSession]) + }, [state, clearCurrentAccount, initSession]) const stateContext = React.useMemo( () => ({ |