diff --git a/src/components/navigatorBar/index.tsx b/src/components/navigatorBar/index.tsx
index d3c9e338..b11d920e 100644
--- a/src/components/navigatorBar/index.tsx
+++ b/src/components/navigatorBar/index.tsx
@@ -3,8 +3,6 @@ import ActiveLink from '@components/activeLink';
import CreatePost from '@components/navigatorBar/createPost';
import { ProfileMenu } from '@components/navigatorBar/profileMenu';
-import { truncate } from '@utils/truncate';
-
import { currentUser } from '@stores/currentUser';
import { useStore } from '@nanostores/react';
@@ -12,7 +10,10 @@ import { PlusIcon } from '@radix-ui/react-icons';
export default function NavigatorBar() {
const $currentUser: any = useStore(currentUser);
- const profile = JSON.parse($currentUser.metadata);
+ const profile =
+ $currentUser.metadata !== undefined
+ ? JSON.parse($currentUser.metadata)
+ : { display_name: null, username: null };
return (
@@ -23,13 +24,11 @@ export default function NavigatorBar() {
- {profile.display_name || profile.name}
+ {profile.display_name || ''}
-
- @{profile.username || truncate($currentUser.pubkey, 16, ' .... ')}
-
+
@{profile.username || ''}
diff --git a/src/components/navigatorBar/profileMenu.tsx b/src/components/navigatorBar/profileMenu.tsx
index 3aa65138..871feefd 100644
--- a/src/components/navigatorBar/profileMenu.tsx
+++ b/src/components/navigatorBar/profileMenu.tsx
@@ -13,10 +13,7 @@ export const ProfileMenu = memo(function ProfileMenu({ pubkey }: { pubkey: strin
};
const updateProfile = () => {
- router.push({
- pathname: '/profile/update',
- query: { pubkey: pubkey },
- });
+ router.push('/profile/update');
};
const copyPubkey = async () => {
diff --git a/src/pages/profile/update.tsx b/src/pages/profile/update.tsx
index 4d220a38..33585017 100644
--- a/src/pages/profile/update.tsx
+++ b/src/pages/profile/update.tsx
@@ -29,7 +29,10 @@ export default function Page() {
const [loading, setLoading] = useState(false);
const $currentUser: any = useStore(currentUser);
- const profile = JSON.parse($currentUser.metadata);
+ const profile =
+ $currentUser.metadata !== undefined
+ ? JSON.parse($currentUser.metadata)
+ : { display_name: null, username: null };
const {
register,