diff --git a/src/hooks/useFetchProfile.tsx b/src/hooks/useFetchProfile.tsx index 3e625b7..ca3de6d 100644 --- a/src/hooks/useFetchProfile.tsx +++ b/src/hooks/useFetchProfile.tsx @@ -4,7 +4,7 @@ import client from '@/services/client.service' import { TProfile } from '@/types' import { useEffect, useState } from 'react' -export function useFetchProfile(id?: string) { +export function useFetchProfile(id?: string, skipCache = false) { const { profile: currentAccountProfile } = useNostr() const [isFetching, setIsFetching] = useState(true) const [error, setError] = useState(null) @@ -25,7 +25,7 @@ export function useFetchProfile(id?: string) { const pubkey = userIdToPubkey(id) setPubkey(pubkey) - const profile = await client.fetchProfile(id) + const profile = await client.fetchProfile(id, skipCache) if (profile) { setProfile(profile) } diff --git a/src/pages/secondary/ProfilePage/index.tsx b/src/pages/secondary/ProfilePage/index.tsx index 4301426..41cc772 100644 --- a/src/pages/secondary/ProfilePage/index.tsx +++ b/src/pages/secondary/ProfilePage/index.tsx @@ -28,7 +28,7 @@ import Relays from './Relays' const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref) => { const { t } = useTranslation() const { push } = useSecondaryPage() - const { profile, isFetching } = useFetchProfile(id) + const { profile, isFetching } = useFetchProfile(id, true) const { pubkey: accountPubkey } = useNostr() const { mutePubkeys } = useMuteList() const { followings } = useFetchFollowings(profile?.pubkey) diff --git a/src/services/client.service.ts b/src/services/client.service.ts index 6247e40..8f058e2 100644 --- a/src/services/client.service.ts +++ b/src/services/client.service.ts @@ -686,12 +686,7 @@ class ClientService extends EventTarget { } async fetchProfile(id: string, skipCache: boolean = false): Promise { - let profileEvent: NEvent | undefined - if (skipCache) { - profileEvent = await this.fetchProfileEvent(id, skipCache) - } else { - profileEvent = await this.fetchProfileEvent(id) - } + const profileEvent = await this.fetchProfileEvent(id, skipCache) if (profileEvent) { return getProfileFromProfileEvent(profileEvent) }