fix: fetch profile from current relays if user has no relay list
This commit is contained in:
parent
e556b83f5c
commit
1b7ec56c89
3 changed files with 20 additions and 9 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { createContext, useCallback, useContext, useMemo, useState } from 'react'
|
||||
import client from '@/services/client.service'
|
||||
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react'
|
||||
|
||||
type TCurrentRelaysContext = {
|
||||
relayUrls: string[]
|
||||
|
|
@ -20,6 +21,10 @@ export function CurrentRelaysProvider({ children }: { children: React.ReactNode
|
|||
const [relayRefCount, setRelayRefCount] = useState<Record<string, number>>({})
|
||||
const relayUrls = useMemo(() => Object.keys(relayRefCount), [relayRefCount])
|
||||
|
||||
useEffect(() => {
|
||||
client.currentRelays = relayUrls
|
||||
}, [relayUrls])
|
||||
|
||||
const addRelayUrls = useCallback((urls: string[]) => {
|
||||
setRelayRefCount((prev) => {
|
||||
const newCounts = { ...prev }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue