diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index 7cc9f691..6f7f2de7 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -94,6 +94,7 @@ export function usePrefetchProfileQuery() { const prefetchProfileQuery = useCallback( async (did: string) => { await queryClient.prefetchQuery({ + staleTime: STALE.SECONDS.THIRTY, queryKey: RQKEY(did), queryFn: async () => { const res = await agent.getProfile({actor: did || ''}) diff --git a/src/view/com/util/PostMeta.tsx b/src/view/com/util/PostMeta.tsx index b6fe6d37..df45174b 100644 --- a/src/view/com/util/PostMeta.tsx +++ b/src/view/com/util/PostMeta.tsx @@ -11,6 +11,7 @@ import {sanitizeHandle} from 'lib/strings/handles' import {niceDate} from 'lib/strings/time' import {TypographyVariant} from 'lib/ThemeContext' import {isAndroid, isWeb} from 'platform/detection' +import {atoms as a} from '#/alf' import {ProfileHoverCard} from '#/components/ProfileHoverCard' import {TextLinkOnWebOnly} from './Link' import {Text} from './text/Text' @@ -39,9 +40,13 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => { const prefetchProfileQuery = usePrefetchProfileQuery() const profileLink = makeProfileLink(opts.author) - const onPointerEnter = isWeb - ? () => prefetchProfileQuery(opts.author.did) - : undefined + const prefetchedProfile = React.useRef(false) + const onPointerMove = React.useCallback(() => { + if (!prefetchedProfile.current) { + prefetchedProfile.current = true + prefetchProfileQuery(opts.author.did) + } + }, [opts.author.did, prefetchProfileQuery]) const queryClient = useQueryClient() const onOpenAuthor = opts.onOpenAuthor @@ -66,37 +71,39 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => { )} - - - {sanitizeDisplayName( - displayName, - opts.moderation?.ui('displayName'), - )} - - } - href={profileLink} - onBeforePress={onBeforePressAuthor} - onPointerEnter={onPointerEnter} - /> - - + + + + {sanitizeDisplayName( + displayName, + opts.moderation?.ui('displayName'), + )} + + } + href={profileLink} + onBeforePress={onBeforePressAuthor} + /> + + + {!isAndroid && (