From b924c53b23a86252328cf4304f1d3050f87a2c41 Mon Sep 17 00:00:00 2001 From: Seth Wood Date: Wed, 26 Feb 2025 07:33:27 -0800 Subject: Fix for avatar preloading (#7816) * mobile avatar profile preloading fix * updating fix to include moderation * removing comments, adding disableNavigation to PreviewableUserAvatarProps --- src/view/com/composer/ComposerReplyTo.tsx | 1 + src/view/com/util/UserAvatar.tsx | 40 +++++++++++++++++++------------ 2 files changed, 26 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/view/com/composer/ComposerReplyTo.tsx b/src/view/com/composer/ComposerReplyTo.tsx index 68313226d..2766fe625 100644 --- a/src/view/com/composer/ComposerReplyTo.tsx +++ b/src/view/com/composer/ComposerReplyTo.tsx @@ -77,6 +77,7 @@ export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) { profile={replyTo.author} moderation={replyTo.moderation?.ui('avatar')} type={replyTo.author.associated?.labeler ? 'labeler' : 'user'} + disableNavigation={true} /> diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx index 5e66a0974..386342103 100644 --- a/src/view/com/util/UserAvatar.tsx +++ b/src/view/com/util/UserAvatar.tsx @@ -66,6 +66,7 @@ interface PreviewableUserAvatarProps extends BaseUserAvatarProps { moderation?: ModerationUI profile: bsky.profile.AnyProfileView disableHoverCard?: boolean + disableNavigation?: boolean onBeforePress?: () => void } @@ -439,6 +440,7 @@ let PreviewableUserAvatar = ({ moderation, profile, disableHoverCard, + disableNavigation, onBeforePress, ...rest }: PreviewableUserAvatarProps): React.ReactNode => { @@ -450,23 +452,31 @@ let PreviewableUserAvatar = ({ precacheProfile(queryClient, profile) }, [profile, queryClient, onBeforePress]) + const avatarEl = ( + + ) + return ( - - - + {disableNavigation ? ( + avatarEl + ) : ( + + {avatarEl} + + )} ) } -- cgit 1.4.1