diff --git a/web/components/profile/profile-info.tsx b/web/components/profile/profile-info.tsx
index 7ae938e3..671f31ff 100644
--- a/web/components/profile/profile-info.tsx
+++ b/web/components/profile/profile-info.tsx
@@ -38,13 +38,16 @@ export function ProfileInfo(props: {
fromProfilePage?: Profile
fromSignup?: boolean
}) {
- const {profile, user, refreshProfile, fromProfilePage, fromSignup} = props
- debug('Rendering Profile for', user.username, user.name, props)
+ const {profile, refreshProfile, fromProfilePage, fromSignup} = props
const currentUser = useUser()
const t = useT()
// const currentProfile = useProfile()
- // const isCurrentUser = currentUser?.id === user.id
+
+ const isCurrentUser = currentUser?.id === props.user.id
+ const user = isCurrentUser ? currentUser : props.user // to refresh user info after update
+
+ debug('Rendering Profile for', user.username, user.name, props)
const {data: starredUsers, refresh: refreshStars} = useGetter('stars', currentUser?.id, getStars)
const starredUserIds = starredUsers?.map((u) => u.id)
@@ -319,7 +322,7 @@ function ProfileContent(props: {
{currentUser && (
//
-
+
//
)}
diff --git a/web/hooks/use-profile.tsx b/web/hooks/use-profile.tsx
index 6f674450..35ce21be 100644
--- a/web/hooks/use-profile.tsx
+++ b/web/hooks/use-profile.tsx
@@ -99,3 +99,32 @@ export const useProfileByUserId = (userId: string | undefined) => {
return profile
}
+//
+// async function getUserById(userId: string) {
+// const userRes = await run(
+// db
+// .from('users')
+// .select(`id, name, username, created_time, avatar_url, is_banned_from_posting`)
+// .eq('id', userId),
+// )
+// const user = userRes.data?.[0]
+// if (!user) return null
+// return convertPartialUser(user)
+// }
+//
+// export const useUserById = (userId: string | undefined) => {
+// const [user, setUser] = usePersistentInMemoryState(
+// undefined,
+// `user-${userId}`,
+// )
+//
+// useEffect(() => {
+// if (userId) {
+// getUserById(userId).then((user) => {
+// setUser(user ?? null)
+// })
+// }
+// }, [userId])
+//
+// return user
+// }