diff --git a/src/components/Common/Username.tsx b/src/components/Common/Username.tsx index 734b0630e..68e328bcd 100644 --- a/src/components/Common/Username.tsx +++ b/src/components/Common/Username.tsx @@ -52,8 +52,7 @@ function getBlockieScale(size?: string) { } const Username = ({ address, size, linked, variant = UsernameVariant.Full, strong = false, className }: Props) => { - const { profile, hasDclProfile } = useProfile(address) - const profileHasName = hasDclProfile && profile!.name && profile!.name.length > 0 + const { profile, hasDclProfile, displayableAddress, profileHasName } = useProfile(address) const blockieScale = getBlockieScale(size) const isAddressVariant = variant === UsernameVariant.Address const isAvatarVariant = variant === UsernameVariant.Avatar @@ -63,7 +62,7 @@ const Username = ({ address, size, linked, variant = UsernameVariant.Full, stron <> {isAddressVariant && ( <> - {profileHasName && profile!.name} + {profileHasName && displayableAddress} {!profileHasName &&
} )} @@ -73,7 +72,7 @@ const Username = ({ address, size, linked, variant = UsernameVariant.Full, stron {hasDclProfile && ( <> - {profileHasName && !isAvatarVariant && {profile!.name}} + {profileHasName && !isAvatarVariant && {displayableAddress}} {!profileHasName && !isAvatarVariant &&
} )} diff --git a/src/hooks/useProfile.ts b/src/hooks/useProfile.ts index 832bcba25..b13b0ec27 100644 --- a/src/hooks/useProfile.ts +++ b/src/hooks/useProfile.ts @@ -28,5 +28,5 @@ export default function useProfile(address?: string | null) { const profileHasName = hasDclProfile && !!profile.name && profile.name.length > 0 && profile.hasClaimedName const displayableAddress = profileHasName ? profile.name : address - return { profile, hasDclProfile, displayableAddress, isLoadingProfile } + return { profile, hasDclProfile, displayableAddress, isLoadingProfile, profileHasName } }