From 89db69ce552bfc489b91a78af7a20addcb17b859 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Tue, 4 Aug 2026 15:11:57 +0300 Subject: [PATCH] inline the did reads, drop the getDidFromClient util Co-Authored-By: Claude Fable 5 --- src/ageAssurance/data.tsx | 12 ------------ src/state/queries/messages/restrictChatSettings.ts | 3 +-- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/ageAssurance/data.tsx b/src/ageAssurance/data.tsx index eee50ba74e..9cf6703dfc 100644 --- a/src/ageAssurance/data.tsx +++ b/src/ageAssurance/data.tsx @@ -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 */ diff --git a/src/state/queries/messages/restrictChatSettings.ts b/src/state/queries/messages/restrictChatSettings.ts index 915fcf6738..b47440bf6b 100644 --- a/src/state/queries/messages/restrictChatSettings.ts +++ b/src/state/queries/messages/restrictChatSettings.ts @@ -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 { - const did = getDidFromClient(client) + const did = client.did if (!did) return const cached = getOtherRequiredDataFromCache({did})?.actorDeclaration