Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Set profile hover prefetch stale time to 30s (#4417)

* Set prefetch stale time to 30s

* Run prefetch on mouseOver

* Only prefetch once on mousemove

authored by

Eric Bailey and committed by
GitHub
d989128e 247af5ae

+42 -34
+1
src/state/queries/profile.ts
··· 94 94 const prefetchProfileQuery = useCallback( 95 95 async (did: string) => { 96 96 await queryClient.prefetchQuery({ 97 + staleTime: STALE.SECONDS.THIRTY, 97 98 queryKey: RQKEY(did), 98 99 queryFn: async () => { 99 100 const res = await agent.getProfile({actor: did || ''})
+41 -34
src/view/com/util/PostMeta.tsx
··· 11 11 import {niceDate} from 'lib/strings/time' 12 12 import {TypographyVariant} from 'lib/ThemeContext' 13 13 import {isAndroid, isWeb} from 'platform/detection' 14 + import {atoms as a} from '#/alf' 14 15 import {ProfileHoverCard} from '#/components/ProfileHoverCard' 15 16 import {TextLinkOnWebOnly} from './Link' 16 17 import {Text} from './text/Text' ··· 39 40 const prefetchProfileQuery = usePrefetchProfileQuery() 40 41 41 42 const profileLink = makeProfileLink(opts.author) 42 - const onPointerEnter = isWeb 43 - ? () => prefetchProfileQuery(opts.author.did) 44 - : undefined 43 + const prefetchedProfile = React.useRef(false) 44 + const onPointerMove = React.useCallback(() => { 45 + if (!prefetchedProfile.current) { 46 + prefetchedProfile.current = true 47 + prefetchProfileQuery(opts.author.did) 48 + } 49 + }, [opts.author.did, prefetchProfileQuery]) 45 50 46 51 const queryClient = useQueryClient() 47 52 const onOpenAuthor = opts.onOpenAuthor ··· 66 71 </View> 67 72 )} 68 73 <ProfileHoverCard inline did={opts.author.did}> 69 - <Text 70 - numberOfLines={1} 71 - style={[styles.maxWidth, pal.textLight, opts.displayNameStyle]}> 72 - <TextLinkOnWebOnly 73 - type={opts.displayNameType || 'lg-bold'} 74 - style={[pal.text]} 75 - lineHeight={1.2} 76 - disableMismatchWarning 77 - text={ 78 - <> 79 - {sanitizeDisplayName( 80 - displayName, 81 - opts.moderation?.ui('displayName'), 82 - )} 83 - </> 84 - } 85 - href={profileLink} 86 - onBeforePress={onBeforePressAuthor} 87 - onPointerEnter={onPointerEnter} 88 - /> 89 - <TextLinkOnWebOnly 90 - type="md" 91 - disableMismatchWarning 92 - style={[pal.textLight, {flexShrink: 4}]} 93 - text={'\xa0' + sanitizeHandle(handle, '@')} 94 - href={profileLink} 95 - onBeforePress={onBeforePressAuthor} 96 - onPointerEnter={onPointerEnter} 97 - anchorNoUnderline 98 - /> 99 - </Text> 74 + <View 75 + onPointerMove={isWeb ? onPointerMove : undefined} 76 + style={[a.flex_1]}> 77 + <Text 78 + numberOfLines={1} 79 + style={[styles.maxWidth, pal.textLight, opts.displayNameStyle]}> 80 + <TextLinkOnWebOnly 81 + type={opts.displayNameType || 'lg-bold'} 82 + style={[pal.text]} 83 + lineHeight={1.2} 84 + disableMismatchWarning 85 + text={ 86 + <> 87 + {sanitizeDisplayName( 88 + displayName, 89 + opts.moderation?.ui('displayName'), 90 + )} 91 + </> 92 + } 93 + href={profileLink} 94 + onBeforePress={onBeforePressAuthor} 95 + /> 96 + <TextLinkOnWebOnly 97 + type="md" 98 + disableMismatchWarning 99 + style={[pal.textLight, {flexShrink: 4}]} 100 + text={'\xa0' + sanitizeHandle(handle, '@')} 101 + href={profileLink} 102 + onBeforePress={onBeforePressAuthor} 103 + anchorNoUnderline 104 + /> 105 + </Text> 106 + </View> 100 107 </ProfileHoverCard> 101 108 {!isAndroid && ( 102 109 <Text