feat: force refresh of user relay list cache when viewing profile
This commit is contained in:
@@ -66,7 +66,7 @@ const ProfileListPage = forwardRef(({ index }: { index?: number }, ref) => {
|
||||
if (urls.length === 0) {
|
||||
return setHasMore(false)
|
||||
}
|
||||
const profiles = await client.fetchProfiles(urls, { ...filter, limit: LIMIT })
|
||||
const profiles = await client.searchProfiles(urls, { ...filter, limit: LIMIT })
|
||||
const newPubkeySet = new Set<string>()
|
||||
profiles.forEach((profile) => {
|
||||
if (!pubkeySet.has(profile.pubkey)) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import { generateImageByPubkey } from '@/lib/pubkey'
|
||||
import { SecondaryPageLink, useSecondaryPage } from '@/PageManager'
|
||||
import { useMuteList } from '@/providers/MuteListProvider'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import client from '@/services/client.service'
|
||||
import { Link, Zap } from 'lucide-react'
|
||||
import { forwardRef, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
@@ -28,7 +29,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, true)
|
||||
const { profile, isFetching } = useFetchProfile(id)
|
||||
const { pubkey: accountPubkey } = useNostr()
|
||||
const { mutePubkeys } = useMuteList()
|
||||
const { followings } = useFetchFollowings(profile?.pubkey)
|
||||
@@ -50,6 +51,18 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!profile?.pubkey) return
|
||||
|
||||
const forceUpdateCache = async () => {
|
||||
await Promise.all([
|
||||
client.forceUpdateRelayListEvent(profile.pubkey),
|
||||
client.fetchProfile(profile.pubkey, true)
|
||||
])
|
||||
}
|
||||
forceUpdateCache()
|
||||
}, [profile?.pubkey])
|
||||
|
||||
useEffect(() => {
|
||||
if (!topContainer) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user