inline the did reads, drop the getDidFromClient util

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-04 15:11:57 +03:00
parent 4c5294a1a2
commit 89db69ce55
2 changed files with 1 additions and 14 deletions
-12
View File
@@ -7,7 +7,6 @@ import {
AtpAgent,
type ChatBskyActorDeclaration,
} from '@atproto/api'
import {type Client} from '@atproto/lex'
import {createAsyncStoragePersister} from '@tanstack/query-async-storage-persister'
import {focusManager, QueryClient, useQuery} from '@tanstack/react-query'
import {persistQueryClient} from '@tanstack/react-query-persist-client'
@@ -70,17 +69,6 @@ export function getDidFromAgentSession(agent: AtpAgent) {
return sessionManager.did
}
/**
* Reads the active account did from a lex {@link Client}. Logged-out clients
* expose `did: undefined`, so this returns undefined in that case.
*
* Lives alongside {@link getDidFromAgentSession} rather than replacing it: the
* rest of this file is still agent-shaped and blocked on `getPreferences`.
*/
export function getDidFromClient(client: Client) {
return client.did
}
/*
* Optimistic data
*/
@@ -3,7 +3,6 @@ import {type Client} from '@atproto/lex'
import {networkRetry} from '#/lib/async/retry'
import {logger} from '#/logger'
import {
getDidFromClient,
getOtherRequiredDataFromCache,
setOtherRequiredDataActorDeclarationCache,
} from '#/ageAssurance/data'
@@ -32,7 +31,7 @@ export async function restrictChatSettings({
restrictIncoming?: boolean
restrictGroupInvites?: boolean
}): Promise<void> {
const did = getDidFromClient(client)
const did = client.did
if (!did) return
const cached = getOtherRequiredDataFromCache({did})?.actorDeclaration