migrate link resolution to the appview and chat clients
`resolveLink` took an agent and used it for four appview reads plus the chat invite preview, so it now takes both clients as a `LinkResolvers` pair - the caller cannot know which branch a URL will take until it is parsed. That was the last DM_SERVICE_HEADERS site, so the constant is deleted. `resolveGif` never touched the agent at all (it is pure URL metadata work on what the picker already returned), so its parameter is dropped rather than replaced, along with the one on `fetchResolveGifQuery`. With the resolvers on clients, `apilib.post` loses the agent parameter the previous slice kept solely for them, and `composerStateToDraft` takes the resolver pair instead of minting a throwaway public agent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -97,8 +97,8 @@ import {usePreferencesQuery} from '#/state/queries/preferences'
|
||||
import {useProfileQuery} from '#/state/queries/profile'
|
||||
import {resolveLinkQueryOptions} from '#/state/queries/resolve-link'
|
||||
import {
|
||||
useAgent,
|
||||
useAppviewClient,
|
||||
useChatClient,
|
||||
usePdsClient,
|
||||
useSession,
|
||||
} from '#/state/session'
|
||||
@@ -280,8 +280,8 @@ export const ComposePost = ({
|
||||
const videoMaxDurationMs = allow10MinuteVideos
|
||||
? VIDEO_10_MINUTE_MAX_DURATION_MS
|
||||
: VIDEO_MAX_DURATION_MS
|
||||
const agent = useAgent()
|
||||
const client = useAppviewClient()
|
||||
const chatClient = useChatClient()
|
||||
const pdsClient = usePdsClient()
|
||||
const queryClient = useQueryClient()
|
||||
const currentDid = currentAccount!.did
|
||||
@@ -1003,7 +1003,7 @@ export const ComposePost = ({
|
||||
.map(post => post.embed.link!.uri)
|
||||
const linkQueries = useQueries({
|
||||
queries: linkUris.map(uri => ({
|
||||
...resolveLinkQueryOptions(agent, uri),
|
||||
...resolveLinkQueryOptions({appviewClient: client, chatClient}, uri),
|
||||
enabled: false,
|
||||
})),
|
||||
})
|
||||
@@ -1094,12 +1094,13 @@ export const ComposePost = ({
|
||||
try {
|
||||
logger.info(`composer: posting...`)
|
||||
postUri = (
|
||||
await apilib.post(agent, queryClient, {
|
||||
await apilib.post(queryClient, {
|
||||
thread: filteredThread,
|
||||
replyTo: replyTo?.uri,
|
||||
onStateChange: setPublishingStage,
|
||||
langs: currentLanguages,
|
||||
appviewClient: client,
|
||||
chatClient,
|
||||
pdsClient,
|
||||
})
|
||||
).uris[0]
|
||||
@@ -1294,8 +1295,8 @@ export const ComposePost = ({
|
||||
}, [
|
||||
l,
|
||||
ax,
|
||||
agent,
|
||||
client,
|
||||
chatClient,
|
||||
pdsClient,
|
||||
canPost,
|
||||
isPublishing,
|
||||
|
||||
Reference in New Issue
Block a user