Prefetch profile links on web (#2634)
This commit is contained in:
parent
157404132f
commit
23a4bbf608
4 changed files with 34 additions and 1 deletions
|
@ -4,6 +4,7 @@ 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
|
||||
|
@ -14,10 +15,16 @@ 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue