crash fix

This commit is contained in:
zmeyer44 2024-05-07 20:46:50 -04:00
parent 866628501c
commit ff6ebb349e
2 changed files with 4 additions and 4 deletions

View File

@ -44,8 +44,8 @@ export default function AvatarStack({
}
function User({ pubkey, className }: { pubkey: string; className: string }) {
const { profile } = useProfile(pubkey);
const npub = nip19.npubEncode(pubkey);
const { profile, npub } = useProfile(pubkey);
// const npub = profilenip19.npubEncode(pubkey);
return (
<Avatar

View File

@ -7,7 +7,7 @@ import { type NDKUserProfile } from "@nostr-dev-kit/ndk";
export default function useProfile(key: string) {
const { ndk, getProfile } = useNDK();
const npub = NOSTR_BECH32_REGEXP.test(key) ? nip19.npubEncode(key) : key;
useEffect(() => {
if (!ndk) return;
if (NOSTR_BECH32_REGEXP.test(key)) {
@ -20,5 +20,5 @@ export default function useProfile(key: string) {
};
}, [key, ndk]);
return { profile: getProfile(key) };
return { profile: getProfile(key), npub: npub };
}