diff options
author | Eric Bailey <git@esb.lol> | 2024-06-24 20:05:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-24 18:05:06 -0700 |
commit | 6cda6412502c9af9ca07194d598ed37e880df23d (patch) | |
tree | af11de38a3ea8bd922006e418eafa0ee97249887 /src/components/FeedCard.tsx | |
parent | 615c0c851e424b0179bb15a16cff05abe7affaf2 (diff) | |
download | voidsky-6cda6412502c9af9ca07194d598ed37e880df23d.tar.zst |
Disable facets in `FeedCard.Description` component (#4620)
Diffstat (limited to 'src/components/FeedCard.tsx')
-rw-r--r-- | src/components/FeedCard.tsx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/components/FeedCard.tsx b/src/components/FeedCard.tsx index 7f3cb88ff..ecf0a1b91 100644 --- a/src/components/FeedCard.tsx +++ b/src/components/FeedCard.tsx @@ -5,6 +5,7 @@ import { AppBskyFeedDefs, AppBskyGraphDefs, AtUri, + RichText as RichTextApi, } from '@atproto/api' import {msg, plural, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -24,7 +25,6 @@ import * as Toast from 'view/com/util/Toast' import {useTheme} from '#/alf' import {atoms as a} from '#/alf' import {Button, ButtonIcon} from '#/components/Button' -import {useRichText} from '#/components/hooks/useRichText' import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' import {Trash_Stroke2_Corner0_Rounded as Trash} from '#/components/icons/Trash' import {Link as InternalLink, LinkProps} from '#/components/Link' @@ -199,13 +199,14 @@ export function TitleAndBylinePlaceholder({creator}: {creator?: boolean}) { } export function Description({description}: {description?: string}) { - const [rt, isResolving] = useRichText(description || '') - if (!description) return null - return isResolving ? ( - <RichText value={description} style={[a.leading_snug]} /> - ) : ( - <RichText value={rt} style={[a.leading_snug]} /> - ) + const rt = React.useMemo(() => { + if (!description) return + const rt = new RichTextApi({text: description || ''}) + rt.detectFacetsWithoutResolution() + return rt + }, [description]) + if (!rt) return null + return <RichText value={rt} style={[a.leading_snug]} disableLinks /> } export function Likes({count}: {count: number}) { |