fix prefetch returning undefined (#8538)

This commit is contained in:
Samuel Newman
2025-06-19 19:25:17 +03:00
committed by GitHub
parent 9be3b0794c
commit d53fdb0dda
2 changed files with 12 additions and 7 deletions
+3 -3
View File
@@ -2,10 +2,10 @@ import React from 'react'
import {
AppBskyEmbedRecord,
AppBskyEmbedRecordWithMedia,
AppBskyFeedDefs,
type AppBskyFeedDefs,
AppBskyFeedPostgate,
AtUri,
BskyAgent,
type BskyAgent,
} from '@atproto/api'
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
@@ -139,7 +139,7 @@ export function usePostgateQuery({postUri}: {postUri: string}) {
staleTime: STALE.SECONDS.THIRTY,
queryKey: createPostgateQueryKey(postUri),
async queryFn() {
return (await getPostgateRecord({agent, postUri})) ?? null
return await getPostgateRecord({agent, postUri}).then(res => res ?? null)
},
})
}