ensure app session state refreshes on reactivation (#9954)

Co-authored-by: Samuel Newman <mozzius@protonmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Spence Pope
2026-02-26 05:06:16 -05:00
committed by GitHub
parent db9c2a1596
commit 398df1a4b5
+5 -3
View File
@@ -14,6 +14,7 @@ import {
useSession,
useSessionApi,
} from '#/state/session'
import {agentToSessionAccountOrThrow} from '#/state/session/agent'
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
import {Logo} from '#/view/icons/Logo'
import {atoms as a, useTheme} from '#/alf'
@@ -36,7 +37,7 @@ export function Deactivated() {
const {onPressSwitchAccount, pendingDid} = useAccountSwitcher()
const {setShowLoggedOut} = useLoggedOutViewControls()
const hasOtherAccounts = accounts.length > 1
const {logoutCurrentAccount} = useSessionApi()
const {logoutCurrentAccount, resumeSession} = useSessionApi()
const agent = useAgent()
const [pending, setPending] = React.useState(false)
const [error, setError] = React.useState<string | undefined>()
@@ -72,7 +73,8 @@ export function Deactivated() {
setPending(true)
await agent.com.atproto.server.activateAccount()
await queryClient.resetQueries()
await agent.resumeSession(agent.session!)
const account = agentToSessionAccountOrThrow(agent)
await resumeSession({...account, active: true, status: undefined})
} catch (e: any) {
switch (e.message) {
case 'Bad token scope':
@@ -93,7 +95,7 @@ export function Deactivated() {
} finally {
setPending(false)
}
}, [_, agent, setPending, setError, queryClient])
}, [_, agent, queryClient, resumeSession])
return (
<View style={[a.util_screen_outer, a.flex_1]}>