Skip to content

Commit

Permalink
crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zmeyer44 committed May 8, 2024
1 parent 8666285 commit ff6ebb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/ProfileContainers/AvatarStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/hooks/useProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -20,5 +20,5 @@ export default function useProfile(key: string) {
};
}, [key, ndk]);

return { profile: getProfile(key) };
return { profile: getProfile(key), npub: npub };
}

0 comments on commit ff6ebb3

Please sign in to comment.