remove prefetch on hover (maybe revert, just example)
This commit is contained in:
@@ -63,30 +63,6 @@ export function useProfilesQuery({handles}: {handles: string[]}) {
|
||||
})
|
||||
}
|
||||
|
||||
export function usePrefetchProfileQuery() {
|
||||
const queryClient = useQueryClient()
|
||||
const prefetchProfileQuery = useCallback(
|
||||
(did: string) => {
|
||||
queryClient.prefetchQuery({
|
||||
queryKey: RQKEY(did),
|
||||
queryFn: async () => {
|
||||
const res = await getAgent().getProfile({actor: did || ''})
|
||||
return res.data
|
||||
},
|
||||
})
|
||||
},
|
||||
[queryClient],
|
||||
)
|
||||
return prefetchProfileQuery
|
||||
}
|
||||
|
||||
export function cacheProfileBasic(
|
||||
queryClient: QueryClient,
|
||||
profile: AppBskyActorDefs.ProfileViewBasic,
|
||||
) {
|
||||
queryClient.setQueryData(profileBasicKey(profile.handle), profile)
|
||||
}
|
||||
|
||||
interface ProfileUpdateParams {
|
||||
profile: AppBskyActorDefs.ProfileView
|
||||
updates:
|
||||
|
||||
@@ -8,11 +8,10 @@ import {TypographyVariant} from 'lib/ThemeContext'
|
||||
import {UserAvatar} from './UserAvatar'
|
||||
import {sanitizeDisplayName} from 'lib/strings/display-names'
|
||||
import {sanitizeHandle} from 'lib/strings/handles'
|
||||
import {isAndroid, isWeb} from 'platform/detection'
|
||||
import {isAndroid} from 'platform/detection'
|
||||
import {TimeElapsed} from './TimeElapsed'
|
||||
import {makeProfileLink} from 'lib/routes/links'
|
||||
import {ModerationUI} from '@atproto/api'
|
||||
import {usePrefetchProfileQuery} from '#/state/queries/profile'
|
||||
|
||||
interface PostMetaOpts {
|
||||
author: {
|
||||
@@ -36,7 +35,6 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => {
|
||||
const pal = usePalette('default')
|
||||
const displayName = opts.author.displayName || opts.author.handle
|
||||
const handle = opts.author.handle
|
||||
const prefetchProfileQuery = usePrefetchProfileQuery()
|
||||
|
||||
return (
|
||||
<View style={[styles.container, opts.style]}>
|
||||
@@ -68,9 +66,6 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => {
|
||||
</>
|
||||
}
|
||||
href={makeProfileLink(opts.author)}
|
||||
onPointerEnter={
|
||||
isWeb ? () => prefetchProfileQuery(opts.author.did) : undefined
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
{!isAndroid && (
|
||||
|
||||
@@ -4,7 +4,6 @@ import {Link} from './Link'
|
||||
import {isAndroid, isWeb} from 'platform/detection'
|
||||
import {makeProfileLink} from 'lib/routes/links'
|
||||
import {useModalControls} from '#/state/modals'
|
||||
import {usePrefetchProfileQuery} from '#/state/queries/profile'
|
||||
|
||||
interface UserPreviewLinkProps {
|
||||
did: string
|
||||
@@ -15,16 +14,10 @@ export function UserPreviewLink(
|
||||
props: React.PropsWithChildren<UserPreviewLinkProps>,
|
||||
) {
|
||||
const {openModal} = useModalControls()
|
||||
const prefetchProfileQuery = usePrefetchProfileQuery()
|
||||
|
||||
if (isWeb || isAndroid) {
|
||||
return (
|
||||
<Link
|
||||
onPointerEnter={() => {
|
||||
if (isWeb) {
|
||||
prefetchProfileQuery(props.did)
|
||||
}
|
||||
}}
|
||||
href={makeProfileLink(props)}
|
||||
title={props.handle}
|
||||
asAnchor
|
||||
|
||||
Reference in New Issue
Block a user