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 Samuel Newman
parent cb7e2ab976
commit c6bcc9a174
+5 -3
View File
@@ -13,6 +13,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'
@@ -35,7 +36,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>()
@@ -71,7 +72,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':
@@ -92,7 +94,7 @@ export function Deactivated() {
} finally {
setPending(false)
}
}, [_, agent, setPending, setError, queryClient])
}, [_, agent, queryClient, resumeSession])
return (
<View style={[a.util_screen_outer, a.flex_1]}>