···77import {InlineLink} from '#/components/Link'
88import {Text, TextProps} from '#/components/Typography'
99import {toShortUrl} from 'lib/strings/url-helpers'
1010-import {getAgent} from '#/state/session'
1110import {TagMenu, useTagMenuControl} from '#/components/TagMenu'
1211import {isNative} from '#/platform/detection'
1312import {useInteractionState} from '#/components/hooks/useInteractionState'
···2019 style,
2120 numberOfLines,
2221 disableLinks,
2323- resolveFacets = false,
2422 selectable,
2523 enableTags = false,
2624 authorHandle,
···3028 testID?: string
3129 numberOfLines?: number
3230 disableLinks?: boolean
3333- resolveFacets?: boolean
3431 enableTags?: boolean
3532 authorHandle?: string
3633 }) {
3737- const detected = React.useRef(false)
3838- const [richText, setRichText] = React.useState<RichTextAPI>(() =>
3939- value instanceof RichTextAPI ? value : new RichTextAPI({text: value}),
3434+ const richText = React.useMemo(
3535+ () =>
3636+ value instanceof RichTextAPI ? value : new RichTextAPI({text: value}),
3737+ [value],
4038 )
4139 const styles = [a.leading_snug, flatten(style)]
4242-4343- React.useEffect(() => {
4444- if (!resolveFacets) return
4545-4646- async function detectFacets() {
4747- const rt = new RichTextAPI({text: richText.text})
4848- await rt.detectFacets(getAgent())
4949- setRichText(rt)
5050- }
5151-5252- if (!detected.current) {
5353- detected.current = true
5454- detectFacets()
5555- }
5656- }, [richText, setRichText, resolveFacets])
57405841 const {text, facets} = richText
5942
+4-2
src/view/screens/Storybook/Typography.tsx
···2222 <Text style={[a.text_2xs]}>atoms.text_2xs</Text>
23232424 <RichText
2525- resolveFacets
2525+ // TODO: This only supports already resolved facets.
2626+ // Resolving them on read is bad anyway.
2627 value={`This is rich text. It can have mentions like @bsky.app or links like https://bsky.social`}
2728 />
2829 <RichText
2930 selectable
3030- resolveFacets
3131+ // TODO: This only supports already resolved facets.
3232+ // Resolving them on read is bad anyway.
3133 value={`This is rich text. It can have mentions like @bsky.app or links like https://bsky.social`}
3234 style={[a.text_xl]}
3335 />