inline the did reads, drop the getDidFromClient util
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,6 @@ import {
|
|||||||
AtpAgent,
|
AtpAgent,
|
||||||
type ChatBskyActorDeclaration,
|
type ChatBskyActorDeclaration,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {type Client} from '@atproto/lex'
|
|
||||||
import {createAsyncStoragePersister} from '@tanstack/query-async-storage-persister'
|
import {createAsyncStoragePersister} from '@tanstack/query-async-storage-persister'
|
||||||
import {focusManager, QueryClient, useQuery} from '@tanstack/react-query'
|
import {focusManager, QueryClient, useQuery} from '@tanstack/react-query'
|
||||||
import {persistQueryClient} from '@tanstack/react-query-persist-client'
|
import {persistQueryClient} from '@tanstack/react-query-persist-client'
|
||||||
@@ -70,17 +69,6 @@ export function getDidFromAgentSession(agent: AtpAgent) {
|
|||||||
return sessionManager.did
|
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
|
* Optimistic data
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {type Client} from '@atproto/lex'
|
|||||||
import {networkRetry} from '#/lib/async/retry'
|
import {networkRetry} from '#/lib/async/retry'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {
|
import {
|
||||||
getDidFromClient,
|
|
||||||
getOtherRequiredDataFromCache,
|
getOtherRequiredDataFromCache,
|
||||||
setOtherRequiredDataActorDeclarationCache,
|
setOtherRequiredDataActorDeclarationCache,
|
||||||
} from '#/ageAssurance/data'
|
} from '#/ageAssurance/data'
|
||||||
@@ -32,7 +31,7 @@ export async function restrictChatSettings({
|
|||||||
restrictIncoming?: boolean
|
restrictIncoming?: boolean
|
||||||
restrictGroupInvites?: boolean
|
restrictGroupInvites?: boolean
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
const did = getDidFromClient(client)
|
const did = client.did
|
||||||
if (!did) return
|
if (!did) return
|
||||||
|
|
||||||
const cached = getOtherRequiredDataFromCache({did})?.actorDeclaration
|
const cached = getOtherRequiredDataFromCache({did})?.actorDeclaration
|
||||||
|
|||||||
Reference in New Issue
Block a user