fix: resolve handle in feed/list urls (#2497)

This commit is contained in:
Mary 2024-01-24 06:11:07 +07:00 committed by GitHub
parent 439f459cef
commit 6076b8f730
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 7 deletions

View file

@ -18,6 +18,7 @@ import {POST_IMG_MAX} from 'lib/constants'
import {logger} from '#/logger'
import {getAgent} from '#/state/session'
import {useGetPost} from '#/state/queries/post'
import {useFetchDid} from '#/state/queries/handle'
export function useExternalLinkFetch({
setQuote,
@ -28,6 +29,7 @@ export function useExternalLinkFetch({
undefined,
)
const getPost = useGetPost()
const fetchDid = useFetchDid()
useEffect(() => {
let aborted = false
@ -55,7 +57,7 @@ export function useExternalLinkFetch({
},
)
} else if (isBskyCustomFeedUrl(extLink.uri)) {
getFeedAsEmbed(getAgent(), extLink.uri).then(
getFeedAsEmbed(getAgent(), fetchDid, extLink.uri).then(
({embed, meta}) => {
if (aborted) {
return
@ -73,7 +75,7 @@ export function useExternalLinkFetch({
},
)
} else if (isBskyListUrl(extLink.uri)) {
getListAsEmbed(getAgent(), extLink.uri).then(
getListAsEmbed(getAgent(), fetchDid, extLink.uri).then(
({embed, meta}) => {
if (aborted) {
return
@ -133,7 +135,7 @@ export function useExternalLinkFetch({
})
}
return cleanup
}, [extLink, setQuote, getPost])
}, [extLink, setQuote, getPost, fetchDid])
return {extLink, setExtLink}
}