diff options
author | dan <dan.abramov@gmail.com> | 2024-05-03 13:46:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-03 13:46:34 +0100 |
commit | 1e484c6318c0f1a2fa46c028d53b92d817293d11 (patch) | |
tree | 904ee4532949dc6ea43afb261a202cc849b01d63 /src | |
parent | cdf7a1957ad6a5bd569f60fb7113c44973f4e2d7 (diff) | |
download | voidsky-1e484c6318c0f1a2fa46c028d53b92d817293d11.tar.zst |
[Session] Reset global agent on expire (#3838)
Diffstat (limited to 'src')
-rw-r--r-- | src/state/session/index.tsx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/state/session/index.tsx b/src/state/session/index.tsx index b9d67f2e0..4894ad696 100644 --- a/src/state/session/index.tsx +++ b/src/state/session/index.tsx @@ -145,6 +145,16 @@ export function Provider({children}: React.PropsWithChildren<{}>) { if (expired) { logger.warn(`session: expired`) emitSessionDropped() + __globalAgent = PUBLIC_BSKY_AGENT + configureModerationForGuest() + setState(s => ({ + accounts: s.accounts, + currentAgentState: { + agent: PUBLIC_BSKY_AGENT, + did: undefined, + }, + needsPersist: true, + })) } /* @@ -175,12 +185,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { refreshedAccount, ...s.accounts.filter(a => a.did !== refreshedAccount.did), ], - currentAgentState: expired - ? { - agent: PUBLIC_BSKY_AGENT, - did: undefined, - } - : s.currentAgentState, + currentAgentState: s.currentAgentState, needsPersist: true, } }) |