[Session] Reset global agent on expire (#3838)

zio/stable
dan 2024-05-03 13:46:34 +01:00 committed by GitHub
parent cdf7a1957a
commit 1e484c6318
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 6 deletions

View File

@ -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,
}
})