An ATproto social media client -- with an independent Appview.

fix prefetch returning undefined (#8538)

authored by samuel.fm and committed by

GitHub d53fdb0d 9be3b079

+12 -7
+9 -4
src/components/dialogs/PostInteractionSettingsDialog.tsx
··· 1 1 import React from 'react' 2 - import {StyleProp, View, ViewStyle} from 'react-native' 3 - import {AppBskyFeedDefs, AppBskyFeedPostgate, AtUri} from '@atproto/api' 2 + import {type StyleProp, View, type ViewStyle} from 'react-native' 3 + import { 4 + type AppBskyFeedDefs, 5 + type AppBskyFeedPostgate, 6 + AtUri, 7 + } from '@atproto/api' 4 8 import {msg, Trans} from '@lingui/macro' 5 9 import {useLingui} from '@lingui/react' 6 10 import {useQueryClient} from '@tanstack/react-query' ··· 22 26 import { 23 27 createThreadgateViewQueryKey, 24 28 getThreadgateView, 25 - ThreadgateAllowUISetting, 29 + type ThreadgateAllowUISetting, 26 30 threadgateViewToAllowUISetting, 27 31 useSetThreadgateAllowMutation, 28 32 useThreadgateViewQuery, ··· 558 562 await Promise.all([ 559 563 queryClient.prefetchQuery({ 560 564 queryKey: createPostgateQueryKey(postUri), 561 - queryFn: () => getPostgateRecord({agent, postUri}), 565 + queryFn: () => 566 + getPostgateRecord({agent, postUri}).then(res => res ?? null), 562 567 staleTime: STALE.SECONDS.THIRTY, 563 568 }), 564 569 queryClient.prefetchQuery({
+3 -3
src/state/queries/postgate/index.ts
··· 2 2 import { 3 3 AppBskyEmbedRecord, 4 4 AppBskyEmbedRecordWithMedia, 5 - AppBskyFeedDefs, 5 + type AppBskyFeedDefs, 6 6 AppBskyFeedPostgate, 7 7 AtUri, 8 - BskyAgent, 8 + type BskyAgent, 9 9 } from '@atproto/api' 10 10 import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query' 11 11 ··· 139 139 staleTime: STALE.SECONDS.THIRTY, 140 140 queryKey: createPostgateQueryKey(postUri), 141 141 async queryFn() { 142 - return (await getPostgateRecord({agent, postUri})) ?? null 142 + return await getPostgateRecord({agent, postUri}).then(res => res ?? null) 143 143 }, 144 144 }) 145 145 }