diff options
author | Hailey <me@haileyok.com> | 2024-04-26 22:31:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-27 06:31:07 +0100 |
commit | 7eb1444f2c82cd25a77445b82178b7299e8452c7 (patch) | |
tree | c160dcafad17ec148f3d0e9b5b03cbf326255821 /src/view/com/util/Link.tsx | |
parent | ce85375c856549371e1e561e21bb5932baca8ea6 (diff) | |
download | voidsky-7eb1444f2c82cd25a77445b82178b7299e8452c7.tar.zst |
remove precacheThreadPostProfiles (#3729)
* remove `precacheThreadPostProfiles` * add `displayName` to `PreviewableUserAvatar` * memo * use `precacheProfile` * pass `profile` directly to `PreviewableUserAvatar` * update the `UserAvatar`'s props * remove feed cache * one more spot * rm unused queryClient * Don't call fn unnecessarily * Preload for display name too * try notification item * add to feeditem * and finally, precache for post threads * timestamp * Fix * onBeforePress --------- Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
Diffstat (limited to 'src/view/com/util/Link.tsx')
-rw-r--r-- | src/view/com/util/Link.tsx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/view/com/util/Link.tsx b/src/view/com/util/Link.tsx index d35d0fcc6..78d995ee8 100644 --- a/src/view/com/util/Link.tsx +++ b/src/view/com/util/Link.tsx @@ -148,6 +148,7 @@ export const TextLink = memo(function TextLink({ dataSet, title, onPress, + onBeforePress, disableMismatchWarning, navigationAction, anchorNoUnderline, @@ -165,6 +166,7 @@ export const TextLink = memo(function TextLink({ disableMismatchWarning?: boolean navigationAction?: 'push' | 'replace' | 'navigate' anchorNoUnderline?: boolean + onBeforePress?: () => void } & TextProps) { const {...props} = useLinkProps({to: sanitizeUrl(href)}) const navigation = useNavigationDeduped() @@ -202,6 +204,7 @@ export const TextLink = memo(function TextLink({ // Let the browser handle opening in new tab etc. return } + onBeforePress?.() if (onPress) { e?.preventDefault?.() // @ts-ignore function signature differs by platform -prf @@ -226,6 +229,7 @@ export const TextLink = memo(function TextLink({ disableMismatchWarning, navigationAction, openLink, + onBeforePress, ], ) const hrefAttrs = useMemo(() => { @@ -274,6 +278,7 @@ interface TextLinkOnWebOnlyProps extends TextProps { title?: string navigationAction?: 'push' | 'replace' | 'navigate' disableMismatchWarning?: boolean + onBeforePress?: () => void onPointerEnter?: () => void anchorNoUnderline?: boolean } @@ -287,6 +292,7 @@ export const TextLinkOnWebOnly = memo(function DesktopWebTextLink({ lineHeight, navigationAction, disableMismatchWarning, + onBeforePress, ...props }: TextLinkOnWebOnlyProps) { if (isWeb) { @@ -302,6 +308,7 @@ export const TextLinkOnWebOnly = memo(function DesktopWebTextLink({ title={props.title} navigationAction={navigationAction} disableMismatchWarning={disableMismatchWarning} + onBeforePress={onBeforePress} {...props} /> ) |