Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Fix links in profiles (#2178)

* Resolve links in profile bios

* Improve solution

* On mobile, dont disable pointer events on the bio richtext

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>

authored by

Eric Bailey
Paul Frazee
and committed by
GitHub
fc85901a bae63f9b

+35 -11
+33 -9
src/view/com/profile/ProfileHeader.tsx
··· 51 51 import {shareUrl} from 'lib/sharing' 52 52 import {s, colors} from 'lib/styles' 53 53 import {logger} from '#/logger' 54 - import {useSession} from '#/state/session' 54 + import {useSession, getAgent} from '#/state/session' 55 55 import {Shadow} from '#/state/cache/types' 56 56 import {useRequireAuth} from '#/state/session' 57 57 import {LabelInfo} from '../util/moderation/LabelInfo' ··· 127 127 const invalidHandle = isInvalidHandle(profile.handle) 128 128 const {isDesktop} = useWebMediaQueries() 129 129 const [showSuggestedFollows, setShowSuggestedFollows] = React.useState(false) 130 - const descriptionRT = React.useMemo( 131 - () => 132 - profile.description 133 - ? new RichTextAPI({text: profile.description}) 134 - : undefined, 135 - [profile], 136 - ) 137 130 const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue(profile) 138 131 const [queueMute, queueUnmute] = useProfileMuteMutationQueue(profile) 139 132 const [queueBlock, queueUnblock] = useProfileBlockMutationQueue(profile) 140 133 const queryClient = useQueryClient() 134 + 135 + /* 136 + * BEGIN handle bio facet resolution 137 + */ 138 + // should be undefined on first render to trigger a resolution 139 + const prevProfileDescription = React.useRef<string | undefined>() 140 + const [descriptionRT, setDescriptionRT] = React.useState< 141 + RichTextAPI | undefined 142 + >( 143 + profile.description 144 + ? new RichTextAPI({text: profile.description}) 145 + : undefined, 146 + ) 147 + React.useEffect(() => { 148 + async function resolveRTFacets() { 149 + // new each time 150 + const rt = new RichTextAPI({text: profile.description || ''}) 151 + await rt.detectFacets(getAgent()) 152 + // replace existing RT instance 153 + setDescriptionRT(rt) 154 + } 155 + 156 + if (profile.description !== prevProfileDescription.current) { 157 + // update prev immediately 158 + prevProfileDescription.current = profile.description 159 + resolveRTFacets() 160 + } 161 + }, [profile.description, setDescriptionRT]) 162 + /* 163 + * END handle bio facet resolution 164 + */ 141 165 142 166 const invalidateProfileQuery = React.useCallback(() => { 143 167 queryClient.invalidateQueries({ ··· 608 632 </Text> 609 633 </View> 610 634 {descriptionRT && !moderation.profile.blur ? ( 611 - <View pointerEvents="none"> 635 + <View pointerEvents={isNative ? 'auto' : 'none'}> 612 636 <RichText 613 637 testID="profileHeaderDescription" 614 638 style={[styles.description, pal.text]}
+2 -2
src/view/com/util/text/RichText.tsx
··· 77 77 type={type} 78 78 text={segment.text} 79 79 href={`/profile/${mention.did}`} 80 - style={[style, lineHeightStyle, pal.link]} 80 + style={[style, lineHeightStyle, pal.link, {pointerEvents: 'auto'}]} 81 81 dataSet={WORD_WRAP} 82 82 />, 83 83 ) ··· 88 88 type={type} 89 89 text={toShortUrl(segment.text)} 90 90 href={link.uri} 91 - style={[style, lineHeightStyle, pal.link]} 91 + style={[style, lineHeightStyle, pal.link, {pointerEvents: 'auto'}]} 92 92 dataSet={WORD_WRAP} 93 93 warnOnMismatchingLabel 94 94 />,