mirror of
https://github.com/t4t5/nostr-react.git
synced 2025-03-17 21:41:42 +01:00
Add onDone + enabled params to useProfile
This commit is contained in:
parent
902627c6a9
commit
9c7f628d87
@ -58,14 +58,20 @@ function useProfileQueue({ pubkey }: { pubkey: string }) {
|
||||
}
|
||||
}
|
||||
|
||||
export function useProfile({ pubkey }: { pubkey: string }) {
|
||||
export function useProfile({
|
||||
pubkey,
|
||||
enabled: _enabled = true,
|
||||
}: {
|
||||
pubkey: string
|
||||
enabled?: boolean
|
||||
}) {
|
||||
const [, setRequestedPubkeys] = useAtom(requestedPubkeysAtom)
|
||||
const { pubkeysToFetch } = useProfileQueue({ pubkey })
|
||||
const enabled = !!pubkeysToFetch.length
|
||||
const enabled = _enabled && !!pubkeysToFetch.length
|
||||
|
||||
const [fetchedProfiles, setFetchedProfiles] = useAtom(fetchedProfilesAtom)
|
||||
|
||||
const { onEvent, onSubscribe, isLoading } = useNostrEvents({
|
||||
const { onEvent, onSubscribe, isLoading, onDone } = useNostrEvents({
|
||||
filter: {
|
||||
kinds: [0],
|
||||
authors: pubkeysToFetch,
|
||||
@ -104,6 +110,7 @@ export function useProfile({ pubkey }: { pubkey: string }) {
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
onDone,
|
||||
data: metadata
|
||||
? {
|
||||
...metadata,
|
||||
|
Loading…
x
Reference in New Issue
Block a user